Boost logo

Boost :

Subject: Re: [boost] [git-help][urgent] How do I ignore an upstream change to one file?
From: Beman Dawes (bdawes_at_[hidden])
Date: 2013-12-28 12:54:53


On Fri, Dec 27, 2013 at 10:36 PM, Rene Rivera <grafikrobot_at_[hidden]> wrote:

> On Fri, Dec 27, 2013 at 9:02 PM, Rene Rivera <grafikrobot_at_[hidden]>
> wrote:
>
> > When I attempt to do an update of the boost superproject I get and error:
> >
> > Froggy:develop grafik$ git pull
> > error: Your local changes to the following files would be overwritten by
> > merge:
> > tools/regression/src/regression.py
> > Please, commit your changes or stash them before you can merge.
> > Aborting
> > Froggy:develop grafik$
> >
> > I know I've made changes. I also know I don't want to throw away my
> > changes. I also know that I don't want to merge the upstream changes to
> > that one file. Hence.. How do I do a pull and have git ignore the
> upstream
> > of only that file? (i.e. throw away the upstream changes because I know
> > that my changes supersede them)
> >
>
> And now that I did a commit to attempt to steamroll over the upstream
> changes.. And to let the pull do a merge.. The merge fails. How the hell do
> I fix this? And how is it that I have yet to come across anything in git
> that is a *single* command :-(
>

I used to run into those sorts of problems when I first started using git,
but as I gradually learn to use the strengths of git they happen less and
less often. Some suggestions:

* It took me awhile to realize that any changes much above the typo level
happen best on a branch created for the purpose. That branch may well be
private, too. Working of a branch of develop, not develop itself, and
that's particularly true for the super-project or other multi-developer
projects.

* Consider stashing, as stashing may well have been the next best option
after branching. Stashing is an easy way to move work out of the way. A
branch can be created and the stashed changes applied to it, leaving
develop ready for a pull. Or the stash just restored after the pull, if for
some reason a branch isn't desired.

* Consider using the merge strategy option, as specifying "-s ours" might
have been the next best option after stashing.

* It took me awhile to realize that many two and three command sequences I
was executing could be done in one command with one or two command line
options. It is a bit easier using one of the graphic git clients because
the options are presented on the dialog box so I don't have to remember
them. For getting started, using several individual commands allows the
results to be checked step-by-step.

HTH,

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk