mailing list archives
Re: resetting git
From: Michael Schierl <schierlm () gmx de>
Date: Mon, 17 Mar 2014 19:32:14 +0100
Am 16.03.2014 22:52, schrieb Robin Wood:
On 16 March 2014 21:49, Robin Wood <robin () digininja org> wrote:
All seemed to work except I had to do these in the other order:
$ git reset --hard upstream/master
$ git checkout master
Depending on what branch you were one before, you might have to reset
the freshly checked out master branch again, if you follow this route.
Should have elaborated, when I did it your way it complained about a
conflict that needed resolving before I could continue.
Sorry, did not think about that :-(
reset seemed to fix that so the checkout could complete.
Another alternative (which is also handy in case you want to temporarily
checkout some different branch to test something there, without either
discarding or committing your changes first) is
$ git stash save
which puts your current changes away into the stash to be popped later
when you want to continue working on it. As we will remove all stashes
anyway later (by using "git stash clear") you could alternatively have
started with this command, followed by the checkout and the reset. Or
just reset it twice. Or reset whatever branch you are on, then delete
local master branch and create it fresh with
$ git checkout -b master
and then delete the branch you happened to be on before.
Lots of ways to get to the same goal. As Tod noted, just nuking your
current repo and cloning it again works too, but depending on your
Internet connection it may take a bit longer (downloading several