Sublime Forum

Using with `git difftool`

#1

I noticed that the CLI docs don’t describe how to set up Sublime Merge as your git difftool client. I found the following commands do the trick:

git config difftool.smerge.cmd 'smerge "$BASE" "$LOCAL" "$REMOTE"'
git config diff.tool smerge

Let me know if I’m missing anything! hth

0 Likes

Smerge.exe mergetool on Windows
#2

I haven’t tried it myself, but you will need the mergetool subcommand: smerge mergetool

2 Likes

#3

I cant get it to work, but the integration in git is not the issue. For posterity,
you can integrate it this way:

echo 'merge_cmd () {
	"$merge_tool_path" mergetool \
		"$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"
}' > /usr/lib/git-core/mergetools/smerge

git config --global merge.tool smerge

Git invokes smerge correctly (accoring to the doc),
but Sumblime Merge will change the cwd and complain about a
missing git repository (It should use only the files anyway).

$ git mergetool
Merging:
package/glibc/glibc.mk

Normal merge conflict for 'package/glibc/glibc.mk':
  {local}: modified file
  {remote}: modified file
+ smerge mergetool ./package/glibc/glibc_BASE_5507.mk ./package/glibc/glibc_LOCAL_5507.mk ./package/glibc/glibc_REMOTE_5507.mk -o package/glibc/glibc.mk
Unable to find a git repository at /usr/bin/smerge
+ check_unchanged
+ test package/glibc/glibc.mk -nt ./package/glibc/glibc_BACKUP_5507.mk
+ true
+ echo package/glibc/glibc.mk seems unchanged.
package/glibc/glibc.mk seems unchanged.
1 Like

#4

Hmm, this gizmo is working:

echo 'merge_cmd () {
	"$merge_tool_path" mergetool \
		"$BASE" "$LOCAL" "$REMOTE" -o "$MERGED" /the/luggage
}' > /usr/lib/git-core/mergetools/smerge

git config --global merge.tool smerge
0 Likes

#5

I too get a bunch of errors complaining about .git does not appear to be a repository when trying to use smerge as my difftool. Would love to see this implemented (with the ability to compare arbitrary commits/branches). Right now I’m using Kaleidoscope for this but Merge is so close to being usable in this way (or perhaps it already is and I’m just unaware how).

0 Likes

#6

Related: Smerge.exe mergetool on Windows

0 Likes

#7

@wbond any info in regards to using Sublime Merge as a diff tool in git?

0 Likes