Git "You have not finished your merge" and do nothing?

Whenever I try to click Git, I get the following:

You have not concluded your merge (MERGE_HEAD exists). Please, commit your changes before you can merge. 

Running git status I get:

 # On branch master nothing to commit (working directory clean) 

Or by running git ls-files -u , I get nothing.

Running git add . and retrying is irrelevant.

What?

+57
git
04 Feb '12 at 18:59
source share
3 answers

Well, finally, I found the answer: git commit -m "Test" apparently fixed this. The result was an empty commit without any changes. Even Github shows an empty commit, but it works.

+104
04 Feb 2018-12-12T00:
source share
— -

Are you done with an empty merge (two parents) or just with an empty commit? In the latter case, you could remove .git/MERGE_HEAD .

Update: Instead of manually deleting MERGE_HEAD , you can also use git merge --abort ( from git 1.7.4 ) or git reset --merge ( from git 1.6.2 ).

It's also worth mentioning that, at least from git 1.8.3 (maybe earlier?), You should see a status message like this if the actual merge is in progress and needs to be committed (if you specified --no-commit , e.g. ):

 # On branch master # All conflicts fixed but you are still merging. # (use "git commit" to conclude merge) # nothing to commit, working directory clean 

If you do not see this and still receive a MERGE_HEAD warning, something is confused, and you should probably just --abort back to its pure state.

Additional information from comments

During git merge, a MERGE_HEAD file is created in the root of the .git folder (next to HEAD, ORIG_HEAD, probably FETCH_HEAD, etc.) to track information about the current merge (in particular, SHA (s) commit (s) that merge into current HEAD). If you remove this, git will no longer think about merging. Obviously, if the merge is actually running, you will not want to delete this file.

+57
Feb 04 '12 at 19:15
source share

Use the git reset command with no parameters. Documents

+11
Oct 21 '15 at 6:16
source share



All Articles