The error you see is:
error: Your local changes to 'foo.cpp' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge.
is that you have uncommitted changes (he talks about it at the very top of the SourceTree screen). Any merge attempt will fail if you have unspecified changes. You have three options:
- All changes (Use:
git reset --hard ) - Discard all changes (Use:
git stash ) - Commit all changes (use:
git add ...; git commit ... )
After you do this, you will be allowed to unite. If you choose option number 3 above, then conflicts may arise; there will be no conflicts for options No. 1 or No. 2. [Note: for option # 2 you will do git stash pop later, and then conflicts can occur.]
For your Q1: do git config merge.tool diff3 (or vimdiff, or something else). Merging can be misleading (usually a three-way merger, so the tool shows three versions and a combined version).
For your Q2: SourceTree does not include its own merge tool; you will need to rely on the other (I use p4merge and SourceTree). Using these configuration options:
difftool.sourcetree.cmd=/Applications/p4merge.app/Contents/MacOS/p4merge "$LOCAL" "$REMOTE" difftool.sourcetree.path= mergetool.sourcetree.cmd=/Applications/p4merge.app/Contents/MacOS/p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED" mergetool.sourcetree.trustexitcode=true
source share