git mergetool with intellij Idea's community edition on windows

759 views Asked by At

I'm using GitExtensions windows software to work with git and i had many trouble configuring it to work with Idea's community edition, to use it as a merge tool. I've installed version 2022.1 of intelliJ Idea community

I followed the instructions here https://coderwall.com/p/gc_hqw/use-intellij-or-webstorm-as-your-git-diff-tool-even-on-windows but it didn't worked for me for conflict resolution

i went to the folder c:\users<login> to edit the .gitconfig file and i added the following sections in it

[merge]
        tool = intellij
[mergetool "intellij"]
        cmd = cmd.exe //c "\"C:/Program Files/IntelliJ IDEA Community Edition 2022.1/bin/idea.bat\" merge \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\""
        trustExitCode = true    

but nothing was launched when launching the mergetool

1

There are 1 answers

0
Andrew Raynier On

I've found this works for me so far on Windows 11, using GitExtensions. I no longer need to specify the cmd.exe app first, but I have to use a "path" value. This can also be set through the "Settings-Git->Config" menu in GitExtensions, where you can manually type in "intellij" if it's not listed in the dropdown selector.

The bottom of my .gitconfig file looks like this:

[diff]
    guitool = intellij
[difftool "intellij"]
    path = C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2023.3.2/bin/idea.bat
    cmd = \"C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2023.3.2/bin/idea.bat\" diff \"$LOCAL\" \"$REMOTE\"
[merge]
    guitool = intellij
[mergetool "intellij"]
    path = C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2023.3.2/bin/idea.bat
    cmd = \"C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2023.3.2/bin/idea.bat\" merge \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"

I can confirm that the difftool command now opens IntelliJ for my diffs with an external tool from GitExtensions, but I have yet to try a merge, due to lack of files to merge in my repo.