On 3/8/2021 2:09 PM, Achim Gratz wrote:
Brian Inglis writes:
It's normally a merge conflict which will not be satisfied by regular
commands to restore the working files to upstream.

So you're pulling on an unclean work tree?  That's a no-no, either keep
your changes on a separate branch (that you can rebase or merge later)
or stash them away for the pull.

As Corinna said, if you're prepared to lose any local changes then

git reset --hard

will do that.  But you should be sure you really didn't want any of your
unfinished business around any more.

If the unfinished business consists of local commits that haven't yet been applied upstream, then I typically do the following:

git fetch  # Find out if upstream has changed since my last pull.  If so...
git format-patch -n  # save n local commits
git reset --hard origin/master
git am 00*  # reapply my local commits

This assumes I've been too lazy to work on a separate branch, which is often the case for small changes.

Ken

Reply via email to