Skip to contentSkip to conversation

how to do "git merge --abort"

DISCUSSION bill lam 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

bill lam

author
#0 lore raw

How to abort a merge if it said there are conflicts but I do not want to (or can not) resolve it for the moment. I can not find the --abort option as that for git-rebase.

Signature · 4 lines
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
#1 lore raw
Quoted 3 lines · bill lam

How to abort a merge if it said there are conflicts but I do not want to (or can not) resolve it for the moment. I can not find the --abort option as that for git-rebase.

It is spelled "git reset --merge" (though --merge was introduced in v1.6.1; prior to that, you had to use "git reset --hard").

I don't know if it is worth adding "git merge --abort" as syntactic sugar.

-Peff

#2 lore raw
Quoted 8 lines · Jeff King
Quoted 3 lines · bill lam

How to abort a merge if it said there are conflicts but I do not want to (or can not) resolve it for the moment. I can not find the --abort option as that for git-rebase.

It is spelled "git reset --merge" (though --merge was introduced in v1.6.1; prior to that, you had to use "git reset --hard").

Umm, no, you still have to use "git reset --hard".

"git reset --merge cmt" is a rough equivalent for

  git stash
  git reset --hard cmt
  git stash pop

and fills the case where you merged with (unrelated) unstaged changes, and want to discard the merge while keeping the changes.

Signature · 2 lines
Thomas Rast
trast@{inf,student}.ethz.ch
#3 lore raw
Quoted 4 lines · Thomas Rast
Quoted 2 lines

It is spelled "git reset --merge" (though --merge was introduced in v1.6.1; prior to that, you had to use "git reset --hard").

Umm, no, you still have to use "git reset --hard".

Ah, sorry, you are right. I have never actually used "--merge", but I knew based on this thread:

http://article.gmane.org/gmane.comp.version-control.git/102067

that the point was to carry dirty state across a reset. So I assumed you could use it to reset a failed merge while leaving dirty state in files unrelated to the merge. But it doesn't actually handle unmerged entries at all.

Thanks for correcting me.

The downside, of course, of "git reset --hard" is that it kills off any dirty state you may have wanted to keep.

-Peff

author
#4 lore raw
In reply to Thomas Rast

Thanks to both of you. I'll try it when the next merge conflicts.

Signature · 4 lines
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3