Last Updated: September 09, 2019
·
25.46K
· sheerun

Use Sublime Text 2 as Git mergetool

Configure your new merge tool:

git config --global mergetool.sublime.cmd "subl -w \$MERGED"
git config --global mergetool.sublime.trustExitCode false 
git config --global merge.tool sublime

And pro re nata:

git mergetool -y

See also: Just from from viewing in less to editing in Sublime Text 2

11 Responses
Add your response

This is great, thanks!

over 1 year ago ·

I can't get this to work on Windows

over 1 year ago ·

@jchannon You must ensure you have subl command in your path that launches sublime text

over 1 year ago ·

Ubercool!

over 1 year ago ·

Meld :)

over 1 year ago ·

Nice

over 1 year ago ·

@jchannon just like @sheerun said you have to make a bash alias for subl on Windows. Then this should work.

over 1 year ago ·

Now with your tip I can use git AND code in the same screen. Brilliant!

over 1 year ago ·

sublime text 3 will work correct? (OS X Maverick)

over 1 year ago ·

@noon-ehos yes st3 works

over 1 year ago ·

@jchannon and other windows users, try this for subl from the command line: http://stackoverflow.com/a/9440776/298758

over 1 year ago ·