Last Updated: February 25, 2016
·
1.541K
· cwood

My Fugitive Mappings

nmap <leader>gcw :write <bar> :Git add %:p <bar> :Gcommit %:p<CR>
nmap <leader>gpb  :execute ":Git push origin " . fugitive#head(0)<CR>
nmap <leader>grb  :execute ":Git pull --rebase origin " . fugitive#head(0)CR>
nmap <leader>gc  :execute ":Git checkout %"<CR>

These are some small mappings I use with fugitive.

  • First writes the file, then addes it then commits it
  • Second will push your branch to origin
  • Third will rebase your branch from the master
  • Last one will checkout the file you are editing. Handy when you need to trash your current edit file and add back the file.