Skip to content

Instantly share code, notes, and snippets.

@lvl-svasseur
Forked from coderxin/git-merge-tool
Last active January 1, 2020 17:29
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save lvl-svasseur/7837523 to your computer and use it in GitHub Desktop.
Save lvl-svasseur/7837523 to your computer and use it in GitHub Desktop.
git mergetool config (by command line or .gitconfig)
[merge]
tool = intellij
# tool = Kaleidoscope
[diff]
tool = intellij
# tool = Kaleidoscope
# intellij mergetool config
[mergetool "intellij"]
cmd = /Applications/IntelliJ\\ IDEA\ 13\\ CE.app/Contents/MacOS/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[difftool "intellij"]
cmd = /Applications/IntelliJ\\ IDEA\ 13\\ CE.app/Contents/MacOS/idea diff $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE")
# Kaleidoscope for merge tool
[difftool "Kaleidoscope"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[mergetool "Kaleidoscope"]
cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
trustExitCode = true
# use intellij as your merge tool
git config --global mergetool.intellij.cmd '/Applications/IntelliJ\ IDEA\ 13\ CE.app/Contents/MacOS/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")'
git config --global mergetool.intellij.trustExitCode false
git config --global merge.tool intellij
git mergetool -y
# use sourcetree as your merge tool
git config --global mergetool.sourcetree.cmd "sourcetree \$LOCAL \$REMOTE"
git config --global mergetool.sourcetree.trustExitCode false
git config --global merge.tool sourcetree
git mergetool -y
# use Sublime as your merge tool
git config --global mergetool.sublime.cmd "subl -w \$LOCAL \$REMOTE"
git config --global mergetool.sublime.trustExitCode false
git config --global merge.tool sublime
git mergetool -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment