This is a Vim plugin which provides misc. utilities for Git.
Like :args
, but {pattern}s are interpreted by Git.
Usage examples:
G args 'tests/*.php'
for all PHP files undertests/
.G args SomeComponent
for all files which paths includesSomeComponent
. Like all*.ts
and*.tsx
files undercomponents/SomeComponent/
.
Open a Git blame viewer for the current buffer.
You can dig into blame prior to the change on the cursor line by typing o
,
and rewind the state by typing u
.
Return the current branch name. Useful for options like 'tabline'
.
It detects detached HEAD state and returns special notation in that case. For example,
REBASE-i
in the middle ofgit rebase -i
master~100
if you intentionally didgit checkout master~100
to investigate a problem
Wrappers for the corresponding Git subcommands. Useful to define key mappings for frequent usage. For example:
" Open a new buffer to edit commit message.
" :write the buffer to commit all modified files.
nnoremap <Leader>vC <Cmd>call g#vc#commit('-av')<CR>
" Open a new buffer to review all uncomitted changes.
nnoremap <Leader>vD <Cmd>call g#vc#diff('HEAD', '--', '.')<CR>
" Revert unstaged changes in the current file.
nnoremap <Leader>vv <Cmd>call g#vc#restore(expand('%'))<CR>
See doc/g.txt.