Reputation: 17762
For some reason lately, every time I pull and get a merge conflict, running git mergetool
reports "No files need merging":
$ git pull
First, rewinding head to replay your work on top of it...
Applying: replaced home button with Cancel
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
Classes/Controllers/HomeController.m
Please, commit your changes or stash them before you can merge.
Aborting
Failed to merge in the changes.
Patch failed at 0002 moved rollback into cancel button in log watching
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".
$ git mergetool
No files need merging
If I run git rebase --abort
and pull again, either the same thing happens on a different conflict, or the pull succeeds with no merge conflict. There are no remote changes between these pulls, so it's not as though the conflict went away.
Here's how this branch and the remote are configured:
[branch "develop"]
remote = origin
merge = refs/heads/develop
rebase = true
[remote "origin"]
url = <my repo url>
fetch = +refs/heads/*:refs/remotes/origin/*
Upvotes: 51
Views: 23888
Reputation: 436
Could it be that you must first run merge? Then if there are merge conflicts to resolve, you can run mergetool. But until there are created as the results of an incomplete merge, I think mergetool will simply report there is nothing to merge.
Upvotes: 0
Reputation: 25523
In my case the issue was that I had another console window open and was running the application (based on create-react-app, with hot reloading) in that window.
Killing the process and closing the other window, then aborting the rebase and retrying worked for me.
Upvotes: 0
Reputation: 9811
Trivial solution
which worked for me:
Git creates some merge related files in the very same directory where the conflicted file is, so remember to run git mergetool
in correct path.
Upvotes: 12
Reputation: 2942
Solution 1:
$git config --global core.trustctime false
If false, the ctime differences between the index and the working copy are ignored; useful when the inode change time is regularly modified by something outside Git (file system crawlers and some backup systems). and core.trustctime is true by default.
Solution 2: just:
$git rebase --skip
It's OK for you to skip it
Upvotes: 5
Reputation: 129546
Merge tools are better at resolving conflicts than stock git. It can't be too opinionated. For example Beyond Compare is syntax aware and will do a lot for you. If you have it configured right, you can just compile and run your solution to test. If it's all good, then just git add -A
and git rebase --continue
. What you are experiencing is normal. Double check your "trust mergetool exit code" setting:
git config --global mergetool.trustExitCode true
Note: the -A option in git add
will stage all changes including deletions and new, untracked files.
Upvotes: 0
Reputation: 17762
It looks like my problem had to do with file timestamps. Thanks to this SO answer suggested by Mark Longair, the following setting fixed it for me:
git config --global core.trustctime false
Upvotes: 17