Skip to content
groenewege edited this page Oct 3, 2011 · 34 revisions

Sublime Text 2: git plugin

I like being able to quickly ask my editor "what's the history of this file?", without having to jump to another window. This plugin implements just enough git commands to be useful to me at the moment.

I may add more, I may not. If you submit a pull request implementing something I missed, I'll almost certainly accept it.

Installation

Package Control

The easiest way to install this is with Package Control.

  • If you just went and installed Package Control, you probably need to restart Sublime Text 2 before doing this next bit.
  • Bring up the Command Palette (Command+Shift+p on OS X, Control+Shift+p on Linux/Windows).
  • Select "Package Control: Install Package" (it'll take a few seconds)
  • Select Git when the list appears.

Package Control will automatically keep Git up to date with the latest version.

More complex methods

First, you need to have git installed and in your $PATH. Afterwards you may need to restart Sublime Text 2 before the plugin will work.

You may have to copy the Git.sublime-settings file to your User folder and change the git_command setting to the full path to git if it's not in the standard system path.

OSX

$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/
$ git clone git://github.com/kemayo/sublime-text-2-git.git Git

Linux (Ubuntu like distros)

$ cd ~/.config/sublime-text-2/Packages/
$ git clone git://github.com/kemayo/sublime-text-2-git.git Git

Windows 7:

Copy the directory to: "C:\Users\<username>\AppData\Roaming\Sublime Text 2\Packages"

Windows XP:

Copy the directory to: "C:\Documents and Settings\<username>\Application Data\Sublime Text 2\Packages"

What's supported?

Command Palette

Status

Status display

Show the status of the repo. Chosing a file gives you a diff of it.

Log viewing

Log view

You can view the log, for the current file or for the whole repo.

Filtered log view

You can use fuzzy matching on the log details while viewing the log to find interesting commits.

Commit details

You can see more details about the given commit. This is either restricted to just your current file, or for all files in the repo, depending on how you got to it.

Diff viewing

Diff view

Show uncommitted changes in the current file or the whole repo. Displays with appropriate syntax highlighting.

Blame

Ugly blame view

Get an annotated version of the entire current file, or just the selected lines. (It's ugly now. I might fix it.)

Add files

Chose from a list of modified files to stage for a commit.

This looks exactly like the status display, so no picture here.

Commit

After adding files, commit them all with a message.

Quick Commit

Add and commit the current file, after asking for a message.

Clone this wiki locally