Git : Merging Issues with Git

Pawan picture Pawan · Jul 17, 2012 · Viewed 83.8k times · Source

I am using git version 1.7.11.msysgit.0

I created a repository under GitHUB and added a file called as README.md with some text content .

Later on , I have installed GIT Client , did a clone to get the server contents on to my machine .

Then I deleted the file README.md on to my local machine .

Now when I do git commit , I get this error

praveenk@MSIN-BT-100 /d/workspace/MYTestRepo (master|MERGING)
$ git commit ;
U       README.md
error: 'commit' is not possible because you have unmerged files.
hint: Fix them up in the work tree,
hint: and then use 'git add/rm <file>' as
hint: appropriate to mark resolution and make a commit,
hint: or use 'git commit -a'.
fatal: Exiting because of an unresolved conflict.

This is with git pull:

$ git pull;
U       README.md
A       One.txt
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.

How to resolve these errors ?

Answer

wadesworld picture wadesworld · Jul 17, 2012

Do this:

git merge --abort
git pull (to be sure you're up-to-date)

Now replace the contents of the README.md file with what you want it to say. If you don't want it at all, do git rm README.md

Then if you replaced the contents, commit and push those contents with:

git add README.md
git commit -m "comment"
git push