After a merge I want to use git mergetool to resolve the issue but it fails with whatever tool I specify:
git mergetool merge tool candidates: opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse ecmerge p4merge araxis bc3 vimdiff emerge Merging: main.c Normal merge conflict for 'main.c': {local}: modified file {remote}: modified file Hit return to start merge resolution tool (kdiff3): merge of main.c failed
The tool I specify doesn't seem to be launched at all.
Output of
git config --list
merge.tool=kdiff3 core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true
Use git mergetool to run one of several merge utilities to resolve merge conflicts. It is typically run after git merge. If one or more <file> parameters are given, the merge tool program will be run to resolve differences on each file (skipping those without conflicts).
How do I cancel a git merge? Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.
git mergetool is fully configurable so you can pretty much chose your favourite tool. In brief, you can set a default mergetool by setting the user config variable merge. tool . If the merge tool is one of the ones supported natively by it you just have to set mergetool.
kdiff3
maybe not installed at your system. If it is, please, check if it is available through your PATH
variable
Try
git config --global merge.tool <your_merge_program>
Also, you can specify your operating system and available merge programs
Note that git 2.10 will offer a better exit status to identify diff/merge tool installation issue.
See commit 45a4f5d (15 Aug 2016) by John Keeping (johnkeeping
).
(Merged by Junio C Hamano -- gitster
-- in commit 331f06d, 19 Aug 2016)
difftool
: always honor fatal error exit codesAt the moment difftool's "trust exit code" logic always suppresses the exit status of the diff utility we invoke.
This is useful because we don't want to exit just because diff returned "1" because the files differ, but it's confusing if the shell returns an error because the selected diff utility is not found.POSIX specifies
- 127 as the exit status for "
command not found
",- 126 for "
command found but is not executable
" and- values greater than 128 if the command terminated because it received a signal
At least bash and dash follow this specification, while diff utilities generally use "
1
" for the exit status we want to ignore.Handle any value of 126 or greater as a special value indicating that some form of fatal error occurred.
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