Sublime Forum

View differences from master in file?

#1

Is there a sublime package that can highlight the lines that are different from the master branch when using git?

I understand that this can be used with sublime_merge, but is there a way to have live updating coloring showing changes from the master branch while I type?

0 Likes

#2

The incremental diff functionality that was added in Sublime build 3200 can tell you what lines are different from the HEAD or index in the git repository (depending on the value of the git_diff_target setting) and that works without having to install anything extra (git, Sublime Merge, etc) though it does require that you use a 64-bit version of Sublime.

It only diffs against those two items, though. Based on your question it’s unclear if that would do what you want or if you literally want it to always show you the differences between the current file and the master branch (i.e. regardless of what the current branch is, state of the repository in general, etc).

If you need that, then you could install GitGutter; in that package the compare_against setting can be any tag, branch or commit hash.

0 Likes

#3

Thanks for this. I finally looked into incremental diff and I understand better what it does. You are correct in understanding that HEAD isn’t what I want, but rather all changes from the branch that I “checked out” from, in this case master.

I downloaded GitGutter and I think it does exactly what I want! I’m very confused at how people work on open source projects without a live update of their diffs.

0 Likes