I have just tried replacing the master
branch on my server with another branch, as the master
was broken, and I couldn't seem to resolve the error...
The branch that I replaced it with is the last working version I had. I did this by running the following commands from my local machine:
git checkout lastWorkingBranch
git merge -s ours master
git checkout master
git merge lastWorkingBranch master
git push origin master
Then, on the server, I ran
git pull origin master
However, this gave the following output:
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'.
root@moon:/code/moon# git stash
costing/views.py: needs merge
tools.py: needs merge
costing/views.py: needs merge
tools.py: needs merge
costing/views.py: unmerged (395725168ffab1962655116880b74158de3e1e56)
costing/views.py: unmerged (95ff89d4160135c2ebefd67a0fc1af2f2a0abc74)
costing/views.py: unmerged (902f9ff57c808cefd074f3ea07fb252f9eedb4e2)
tools.py: unmerged (6832dd3197f838a52396381c30ef55069e24411b)
tools.py: unmerged (24e8179f7689ffacdd50407259f3a12b3d3f609a)
tools.py: unmerged (93b3d0baa5f1b75c85120cc2e7cab7dcd949b9a5)
fatal: git-write-tree: error building trees
Cannot save the current index state
I tried committing & pushing again on my local machine, and then ran a pull
again on the server, and now get the following message:
U costing/views.py U tools.py Pull is not possible because you have unmerged files. Please, fix them up in the work tree, and then use 'git add/rm ' as appropriate to mark resolution, or use 'git commit -a'. root@moon:/code/moon#
I don't understand why I'm getting this...? I have merged and pushed all of my files- how do I fix them up in the work tree?
You have some unmerged files. So, first do commit
or stash
the files.
$ git commit -am <message> # add and commit
$ git pull origin master # pull origin
Or,
$ git add .
$ git stash # remove the files
$ git pull origin master