Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git merge is not possible because I have unmerged files

Tags:

git

merge

git continues to confuse me with its unhelpful error warnings This one really deserves a prize:

git merge is not possible because you have unmerged files 

My situation: My master branch on github was edited (directly in the browser) while my local master branch was also edited.

I wrongly suppose you could simply merge the two versions and be done with it, but also, I cannot merge - because my files are unmerged.

git merge remote/master 

results in

error: merge is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm <file>' hint: as appropriate to mark resolution and make a commit. fatal: Exiting because of an unresolved conflict. 

So, after adding and committing the local change and then trying to merge again, I get:

merge: remote/master - not something we can merge 

Clearly I am missing something essential here... Do I have the wrong idea about what merging means? How do I fix this issue of having a different remote master / local master branch?

like image 683
Kokodoko Avatar asked Mar 18 '16 13:03

Kokodoko


People also ask

How do you fix committing is not possible because you have unmerged files?

hint: Fix them up in the work tree, and then use 'git add/rm <file>' hint: as appropriate to mark resolution and make a commit.

Is it possible to unmerged files git?

Git Pull is Not Possible, Unmerged Files.

How do I fix a merge conflict with deleted files?

Select Stage Changed Files To Commit (Ctrl-I) from Commit menu. Enter a commit comment like "deleted conflicting file" Commit (ctrl-enter) Now if you restart the merge it will (hopefully) work.


1 Answers

I repeatedly had the same challenge sometime ago. This problem occurs mostly when you are trying to pull from the remote repository and you have some files on your local instance conflicting with the remote version, if you are using git from an IDE such as IntelliJ, you will be prompted and allowed to make a choice if you want to retain your own changes or you prefer the changes in the remote version to overwrite yours'. If you don't make any choice then you fall into this conflict. all you need to do is run:

git merge --abort # The unresolved conflict will be cleared off 

And you can continue what you were doing before the break.

like image 160
Mosaku Abayomi Avatar answered Nov 08 '22 12:11

Mosaku Abayomi