Boost logo

Boost :

Subject: Re: [boost] [git-help][urgent] How do I ignore an upstream change to one file?
From: Peter A. Bigot (pab_at_[hidden])
Date: 2013-12-28 06:13:27


On 12/27/2013 09:02 PM, Rene Rivera 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)

Generally how I deal with this is use git-stash to temporarily store the
local changes that are not complete, then do a git pull (or git fetch,
followed by a manual merge from origin/master). Then use git-stash pop
(or apply) to restore my changes.

If there are conflicts and they're easily resolved, you can do that in
the workspace. "git stash pop" will only remove the stashed copy if it
applies cleanly; so if the conflicts can't be easily resolved, you can
use "git reset" to get back to the upstream version, then git-revert to
reject the conflicting upstream patches and get back to where your
changes can be applied. In either case, you end up with a branch that
applies on top of current upstream, which is what you'll want when the
time comes for your changes to supersede the upstream ones.

This may seem like a lot of work, and there may be features of some git
interfaces that simplify it, but it's one way the problem can be solved.

Those who have a handle on basic git operations but aren't familiar with
git-stash are likely to find value in adding it to their toolbox.

Peter


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