Skip to content

Instantly share code, notes, and snippets.

@cognivator
Last active September 19, 2019 23:43
Show Gist options
  • Save cognivator/e2a2f768b626f69d3582cb534379333a to your computer and use it in GitHub Desktop.
Save cognivator/e2a2f768b626f69d3582cb534379333a to your computer and use it in GitHub Desktop.
Configure Sourcetree to use Intellij (Jetbrains) as external Diff or Merge tool

Summary

If the prescribed method of configuring Sourcetree using Jetbrains' command line scripts fails, here is an alternative configuration:

Diff

  • Diff Command: open -W -n -b "com.jetbrains.intellij" --args
  • Diff Arguments: diff "$LOCAL" "$PWD/$REMOTE"

Merge

  • Merge Command: open -W -n -b "com.jetbrains.intellij" --args
  • Merge Arguments: merge "$PWD/$LOCAL" "$PWD/$REMOTE" "$PWD/$BASE" "$PWD/$MERGED"

Details

Failure indications

  • Jetbrains IDE fails to launch from Sourcetree using prescribed 'command line script'
  • Error messages indicating the diff / merge files cannot be found

Adjustments

  • Alter the -b parameter appropriately for the IDE you wish to launch - e.g. com.jetbrains.webstorm
  • Experiment with adding or removing $PWD for the paths, if you continue to get errors for missing files
  • Experiment with adding or removing the -n parameter
    • effect is to launch a new process, although it appears IntelliJ in particular manage to reuse the existing process
    • removing it may prevent IntelliJ from launching the diff or merge window
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment