4

I do a

git pull

and I get merge conflicts. I resolve the merge conflicts manually and issues a pull again but Git refuses to do it as Git is still thinking that there are merge conflicts.

Is there any way to force Git to perform a pull again and make it look for “diffs” (if any ) from the head(without committing the changes I made) ?

Jean
  • 21,665
  • 24
  • 69
  • 119

4 Answers4

5

Why are you issuing a second git pull after fixing the merge conflicts from the first? That makes no sense. Once you fix the merge conflicts, you want to git commit instead, which will create the merge commit that merges the remote branch with your local one (and includes your conflict resolutions).

Lily Ballard
  • 182,031
  • 33
  • 381
  • 347
  • Agree. I was wondering how to make sure that no more merge conflicts exist. An "Already up to date" message from git pull is very much reassuring. – Jean Nov 29 '11 at 21:24
  • 1
    @alertjean: Just run `git status`. It will tell you about all outstanding conflicts. And `git commit` won't commit if you have remaining conflicts. Also, if you use `git mergetool`, it will run through all the conflicts for you. – Lily Ballard Nov 29 '11 at 21:28
3

You have to commit your changes after you resolve the conflicts and push them back. Usually instead of using git pull I do a git fetch followed by a git merge and then git commit. This will only fetch the upstream changes, allow you manually merge and resolve conflicts, then commit them locally. When you're ready push the changes back to upstream.

If you use this workflow you could:

git fetch
git merge 
#resolve conflicts
git commit
git fetch #check for new changes
#eventually
git push
Joel
  • 2,928
  • 2
  • 24
  • 34
0

The process here is:

git pull

You get a notice of conflicts. You use whatever you use (though hopefully you've hooked up everything you need to use git difftool locally...

Once the conflicts are resolved, you now have a working directory that contains the merged of the remote changes and your local changes. The ONLY thing that's different is, git couldn't do the merge on its own and needed your help.

You now

git commit

to create a new commit in your local repo that is the sum of the pulled-in remote changes and your local changes. Then you

git push

to publish your changes, nicely merged up, with the remote head.

Dan Ray
  • 21,623
  • 6
  • 63
  • 87
0

In addiction, after pulled, merged and committed, you can also try (assuming your remote is 'origin', of course)

git remote show origin

It's very reassuring for me!