Thread (37 messages) flat view 37 messages, 8 authors, 2016-06-15

Re: Git rescue mission

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:42:53


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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help