0

I tried to "git pull" from a repo, then I get an error saying, pull is not possible because you have unmerged files, but I done a bit of search on the web, "git pull = git fetch + git merge", isn't it?

I used git pull, then I get the following messages

    U   Assembly-CSharp.pidb
    U   Assembly-UnityScript.pidb
    M   Assets/testing.unity
    U   Library/assetDatabase3
    U   Temp/Undo55e9beda8401848509d9e3bb5d5fe513
    U   Temp/Undof0c17c0ba33904b16a1698563ff5302c
    U   Temp/__EditModeScene
    U   wiisummoner-csharp.sln
    U   wiisummoner.sln
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'.

above is the error message, then I tried "git merge", I get an error " merge is not possible because you have unmerged files". this is so confusing..Anyone know what the problem is? All I want is just pull from repo.

Arafangion
  • 11,517
  • 1
  • 40
  • 72
Qin
  • 63
  • 1
  • 1
  • 10
  • You _still_ aren't providing the full error message. – Arafangion Mar 27 '13 at 06:32
  • What you have of the error message indicates that you are in the middle of a merge, possibly as a result of a previous git pull. Resolve the merge, then do the push. – Arafangion Mar 27 '13 at 06:41

2 Answers2

2

As you state, "git pull" is equivalent to "git fetch + git merge".

If you can not do a "git merge", it follows logically that you can not do a "git pull", because it will do a "git merge" in the process.

You likely have your own files in Temp, or your local *.pidb files may already exist and conflict with the upstream branch.

Putting these files into version control is just asking for trouble, unless you want to version and reconcile differences to these files (and you really don't...), I suggest you reject the upstream changes and tell them to fix it.

Incidentally, for the record, this is what the full output of git pull looks like, I have made a simple test repository to demonstrate:

$ git --version
git version 1.7.12.4 (Apple Git-37)
$ git pull
Updating e78f298..3067a12
error: The following untracked working tree files would be overwritten by merge:
    three.txt
Please move or remove them before you can merge.
Aborting

In this case, the answer is very simple:

  • Move three.txt somewhere else. (Perhaps do git stash to do that)
  • Perform the git pull

Then, if your version of 'three.txt' was significant, additionally perform:

  • Move three.txt back. (If you did git stash, perhaps you could do git stash pop
  • Attempt to reconcile the differences so that you aren't just clumsily overwriting the other person's changes.
  • Commit the new changes.
Arafangion
  • 11,517
  • 1
  • 40
  • 72
0

You should stash your changes and pop them after

git stash
git pull
git stash pop

You might have conflicts afterwards that you can fix manually.

The alternative, if it makes sense to create a commit (i.e. you are done with the changes you were making), you can simply commit your changes and pull after that.

Pablo Fernandez heelhook
  • 11,985
  • 3
  • 21
  • 20