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/*
We can manually resolve the merge conflict by editing the content in the bottom pane, and then saving the file using :wqa (Write and Quit all files). Once the conflict resolution is successful, the merged file will be staged for commit. git commit -m 'Merged from multiple branches' .
Restore the unwanted files then with git checkout -- filename . @marckassy: But you could then git reset HEAD and git add -p to select what you want. To shut off the initial merge completely, add -s ours .
This fixed it for me:git mergetool .
I found this fix here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With