Reputation: 442
I am using php-git client to pull branches in my php script. and whenever i do checkout from master to testing i get following error.
error: Pull 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.
my files are on bitbucket server. and i add/modify files on bitbucket and commit there.
I dont understand , I dont mofify anything on my local machine, still i get this error.
Following is my 'git status' output.
Your branch is up-to-date with 'origin/testing'.
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed:
modified: g_1.0.yaml
new file: potter_3.4.yaml
new file: potter_3.4.yml
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: abc_1.0.json
Upvotes: 3
Views: 66563
Reputation: 41
If you don't want to merge changes and still want to update your locale, run:
git reset --hard HEAD
This will reset your local with the head and then pull your remote using the git pull.
If you've already committed your merger locally (but haven't gone remote yet), and would like to return it again:
git reset --hard HEAD~1
Upvotes: 2
Reputation: 13783
If there are unmerged paths that are being staged, you'd need to unstaged them. To find out unmerged paths:
git status
To unstage all:
git restore --staged .
Now you'd be able to pull the changes.
Upvotes: 0
Reputation: 51988
There is a file in the Unmerged paths:
section : abc_1.0.json
.
This is the sign of a conflict. It probably appeared when you ran a previous git pull
from this same branch.
You now have to choose :
if you know that you have something which you modified in abc_1.0.json
, and that you need to keep this modification in this file, resolve the conflict :
abc_1.0.json
in your editor<<<<< HEAD
, =====
, >>>>> testing
)if you know that the current merge is not important, you can run git merge --abort
, and try to pull again.
Upvotes: 0
Reputation: 740
You are in the middle of a merge, try to read the messages you copied, it's pretty clear what you should do: You have unmerged paths. (fix conflicts and run "git commit") (use "git merge --abort" to abort the merge)
So first clear up the merge conflicts
use the merge tool of your choice (eg: tortoise merge, meld )
or do it by hand, in the conflicted file you should see arrows like
<<<<<<< HEAD, select the appropriate one(s)
and then commit
git commit -m "foobar"
Now you should be able to push/pull from your remote, but you may need to pull first, to get the new changes merged locally.
Alternatively, if you don't need your code, and just want to toss out everything and get master, you can allays
git reset --hard origin/master
to reset your local repo to the state of origin/master, but you will loose all local changes
Upvotes: 14