Where to get it
I have a fork of the official repo, with some patches to fix some minor issues:
git clone git://github.com/motemen/git-vim.git git-vim.git cd git-vim.git cp plugin/git.vim ~/.vim/plugin/ cp syntax/git-* ~/.vim/syntax/
The README at the official repo provides a full list, but here are some of the most useful key mappings:
:GitDiffwith no args (shows unstaged changes; same as
:GitDiff --cached(shows staged changes; same as
git diff --cached)
git logfor the current file; to get the repo-wide log you have to manually do
:GitAddwith no args (stages the current file using
:GitAddwith filename completion (stages the specified file using
git commit; but note that if you have no staged changes then it will assume
git commit -a)
In practice I use
:GitCommit -s to sign off my commits;
<leader>gc is really only good for "throw-away" commits because it produces commits without signoffs.
In addition to the commands already mentioned above, some of the more useful ones include:
:Git <args>: arbitrary Git command
:GitCheckout <args>: useful for resetting individual files to the
:GitCheckout HEAD -- foo.c)
There are also a bunch of other commands that I can't really see myself using from within Vim (
:GitCatFile and so on).
Note that commands like
:GitCheckout complete Git commits.