How to use Intellij as merge tool with jj

Justin ThurmanJustin Thurman
1 min read

I’ve been experimenting with jj lately, and I was looking into how to set it up to use GoLand's merge tool for resolving conflicts. There are docs on configuring merge tools in general with jj, but nothing specific to Intellij IDEs.

Thankfully, I found this documentation on how to use IntelliJ's merge tool from the command line, and that was enough to figure out how to configure it to work with jj.

You just need to add the program and merge args to your jj config.toml file. Mine looks like this (configured to use GoLand, but this should work with any Intellij IDE):

[ui]
merge-editor = "goland" # corresponds to `merge-tools.goland` below

[merge-tools.goland]
program = "goland"
merge-args = ["merge", "$left", "$right", "$base", "$output"]

And that's it! If you don't have goland in your path, you may need to specify the full executable path as the program. In my case, it's /Applications/GoLand.app/Contents/MacOS/goland, but you'll have to verify where your IDE is installed.

Update: Turns out this information is already available on the jj wiki on github. I just didn't find it in my initial searching.

0
Subscribe to my newsletter

Read articles from Justin Thurman directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Justin Thurman
Justin Thurman