git mergetool fails
Pergunta
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
Solução
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
Outras dicas
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.