I need to resolve conflicts in git, but as a novice, not sure what is the most effective way.
This is my situation:
I'm in master
and need to commit and push all my changes.
$ git pull:
error: Your local changes to 'foo.cpp' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge.
There are several conflicted files. Of course, I searched the web:
How to resolve merge conflicts in Git?
Unfortunately, neither solutions work well. I may use stash (taking diff and make it clean) and do manual resolving, but want to use git mergetool
or SourceTree.
This is what I've tried:
$ git config merge.conflictstyle diff3
$ git mergetool
merge tool candidates: tortoisemerge emerge vimdiff
No files need merging
$ git mergetool -t vimdiff
No files need merging
$ git mergetool -t vimdiff foo
foo.cpp: file does not need merging
$ git diff foo.cpp
diff --git a/foo.cpp b/foo.cpp
index xxxxxx yyyyy
--- a/foo.cpp
+++ b/foo.cpp
@@ .....
..... <omitted>
$
I'm not sure what is wrong. git mergetool
doesn't work correctly. It says no need to merge. However, it shows the differences and git pull
reports conflict.
Q1) How can I use mergetool
for interactive conflict resolving or merge?
Q2) Is it possible to use SourceTree to resolve conflicts? I tried, but it's also not intuitive.
Thank you!