Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging files in Sublime with Sublimerge via command line

I'm trying to find a better merge file option and wanted to try out Sublime as of my work is done using it. so I installed Sublimerge and now am stuck. I know I can compare two already open files or compare via the Sidebar but what I want to do is fire it off via the command line so I can kick it off from our source control program like I can with every other merge tool I've seen. Does anyone know the command line format to do this?

N.B. - I've long since given up trying to use sublime to handle merges and instead switched to other tools to handle this. Therefore I've never felt I can accept any answer as I'm not checking them to see if they work in the way I'd want, or indeed whether they work at all.

like image 788
Andy Davies Avatar asked Oct 10 '13 13:10

Andy Davies


2 Answers

 subl -n --wait "<LEFT>" "<RIGHT>" --command "sublimerge_diff_views {\"left_read_only\": true, \"right_read_only\": true}"

See "VCS Integration" for details.

like image 81
Nickolay Avatar answered Oct 02 '22 04:10

Nickolay


As Nickolay already suggested, this is the whole directive you have to put in your ~/.gitconfig:

[merge]
    tool = sublimerge

[mergetool "sublimerge"]
    cmd = subl -n --wait \"$REMOTE\" \"$BASE\" \"$LOCAL\" \"$MERGED\" --command \"sublimerge_diff_views\"
    trustExitCode = false

[diff]
    tool = sublimerge

[difftool "sublimerge"]
    cmd = subl -n --wait \"$REMOTE\" \"$LOCAL\" --command \"sublimerge_diff_views {\\\"left_read_only\\\": true, \\\"right_read_only\\\": true}\"
like image 22
jnns Avatar answered Oct 02 '22 05:10

jnns