Did you ever accidentally commit an unwanted change like a debug
import pdb; pdb.set_trace()?
Wouldn’t it be great if you could just see in your editor which lines were modified compared to the latest commit in git?
GitGutter helps you with all of that by making you more aware of how you change your code. Its one little trick is adding little Git diff icons to the gutter area1 of the editor window.
To give you an example, in the screenshot above you can easily see that lines 96-98 were added (green plus marks). Some lines around line 103 were removed (red arrows), and lines 105-108 were modified (bluish squares).
This allows you to quickly see the state of your file as you are editing it – a highly useful thing in practice. Before I’ll give you my verdict let’s take a look at some pros and cons to GitGutter, as well as alternative plugins.
Unobtrusive, but helpful: I found GitGutter to work great as a heads-up display of sorts. It’s subdued enough for me to be able to ignore it when I want to (you could always turn it off temporarily) but it’s there when I need it.
Small footprint: GitGutter does one thing and it does it well. I’m not a fan of ginormous plugins that add a ton of features that I never use. GitGutter is small and simple. It adds one piece of functionality that works well.
Easy to install: Some Sublime Text plugins can be fiddly and difficult to set up correctly (I’m looking at you, linters). GitGutter is extremely easy to install. It doesn’t need any other dependencies besides git. Installing GitGutter with Package Control is a breeze on OS X.
It’s pretty: I’m peculiar about the way my editor looks. If I’m going to be staring at this thing for several hours each day then the colors better be consistent and matching a common theme. Thankfully GitGutter picks its icon colors from your Sublime Text color scheme if the scheme includes support for GitGutter (many do). I use the Tomorrow Night theme and it works great with GitGutter.
Performance issues on older versions: This isn’t anything to worry about today. Since non-blocking mode was introduced GitGutter runs in a separate thread and won’t block editing operations. Non-blocking mode introdcues a slight delay between when you make a modification and when the icons update but it’s hardly noticeable in practice.
Git only: It feels a little silly to mention this for a plugin called GitGutter but please know that GitGutter only works with Git repositories. Again, this is nothing I’d hold against GitGutter. There is a fork called VCS Gutter that works with other version control systems but I haven’t had the need to use it yet.
For Sublime Text, GitGutter seems to be the best option for this type of plugin. I’m not aware of any serious contenders and seeing that GitGutter works so well this doesn’t surprise me.
However there are two alternative versions of GitGutter itself that I’d like to mention:
- GitGutter-Edge: Same as GitGutter, but built from the latest
masterversion on GitHub. I highly recommend that you stick with the release based version, GitGutter.
- VCS Gutter: A fork of GitGutter that supports Git, Mercurial, and Subversion. Worth trying out if you use those.
For other editors, several GitGutter-like plugins are available. I can’t really comment on their quality though.
GitGutter is one of the packages I have installed and activated in my Sublime Text at all times. It’s fast, pretty, and stable. Highly recommended if you use git!
🐍 🐍 🐍 🐍 🐍 (5 out of 5 snakes)
In case you’re wondering, the “gutter” area is the little margin on the left of the text area. ↩