Oct 252013
 

A cool bit of CLI trickery that James Humphrey shared with me. This allows you to use IDEA for diffing and merging via git’s mergetool and difftool commands.

First, add IDEA to your path (everything is in Mac-speak here):

Bash

Fish

Next, add these lines to your ~/.gitconfig file:

That’s it. Now you can use IDEA to diff and merge from git CLI like this:

  6 Responses to “Using IDEA for Git merging and diffing”

  1. Great, thanks for the tip. I think in the Bash config you may want to set PATH=$INTELLIJ_HOME $PATH

  2. Hi. Do you have an example of how to setup idea for merging and diffing on windows?

  3. Unfortunately does not work with PyCharm CE as of now, even though it’s linked in the docs :\

  4. If you’re having trouble getting this to work in MacOS/Linux (in particular, if invoking git diff/merge fails to bring up the IDEA diff/merge window), please note that JetBrains recommends creating a command-line launcher (Tools | Create Command-line Launcher) instead of putting the idea binary on your PATH directly: https://www.jetbrains.com/help/idea/running-intellij-idea-as-a-diff-or-merge-command-line-tool.html

    See also: https://youtrack.jetbrains.com/issue/IDEA-183500

  5. This doesn’t work if idea is opened already. As command exits instantly, and files got deleted after that, Idea has not files to compare.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">