Install
Add Plugin 'tpope/vim-fugitive'
into ~/.vimrc
and run vim +PluginClean +PluginInstall +qa
.
Get Help
:help fugitive
Frequently Use Commands
Action Name | Meaning | Close Window with |
---|---|---|
:Gblame | show info of each line | q |
:Gdiff | show diff in vim | :q |
:Gstatus | show git status | q |
In Gstatus
In ":Gst" window, you can use
"-" to add/remove a file in/out stage area,
"cc" to commit,
"U" to reset (discard local changes), you may need reload the file with :e
"dv" to diff in vertical split,
"ds" or "D" to diff in horizontal split (:q
to quit from diff)
"g?" to see all available actions.
To see the file changes history: :Git log --stat
.
Working with nerdtree
Add Plugin 'Xuyuanp/nerdtree-git-plugin'
into .vimrc.