Re: Git rescue mission
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Feb 8, 2007, 21:23 UTC
- Message-ID
- <Pine.LNX.4.64.0702081321040.8424@woody.linux-foundation.org>
- In-Reply-To
- <87fy9gz9vu.fsf@host94.eke.fi>
On Thu, 8 Feb 2007, Kalle Pokki wrote:
> > I usually undo a pull by throwing away just the merge commit by > > git reset --hard HEAD^
Don't do this.
If the merge just fast-forwarded, you'll do the wrong thing.
So yes, it _works_, but it only works if you actually ended up having a real merge. In contrast, the ORIG_HEAD thing always works.
ORIG_HEAD is also particularly useful for doing things like "ok, what did I get from that pull?" especially when you track somebody elses work (in which case it will basically _always_ be a fast-forward). So I do
gitk ORIG_HEAD..
in git almost every time I pull from Junio's git thing, just because it's a wonderful way to see what has changed, if you're interested in that kind of detail.
Linus