How to quit (not abort) a Git merge in progress keeping the changes uncommitted?

With Git 2.23 (Q3 2019), this will be easier (no more git reset), since “git merge” learned “--quit” option that cleans up the in-progress merge while leaving the working tree and the index still in a mess.

See commit f3f8311 (18 May 2019), and commit b643355 (09 May 2019) by Nguyễn Thái Ngọc Duy (pclouds).
(Merged by Junio C Hamano — gitster in commit c4a38d1, 13 Jun 2019)

merge: add --quit

This allows to cancel the current merge without resetting worktree/index, which is what –abort is for.
Like other --quit(s), this is often used when you forgot that you’re in the middle of a merge and already switched away, doing different things.
By the time you’ve realized, you can’t even continue the merge anymore.

This also makes all in-progress commands, am, merge, rebase, revert and
cherry-pick, take all three --abort, --continue and --quit (bisect has a
different UI).


The documentation is in commit 437591a (17 Jun 2019) by Phillip Wood (phillipwood).
(Merged by Junio C Hamano — gitster in commit 0af6d5d, 09 Jul 2019)

git merge --quit:

Forget about the current merge in progress.
Leave the index and the working tree as-is.

Leave a Comment