Integrating Git with Vim (vim-fugitive)

This section assumes that you understand the basics of working with Git. If you don't (or it's been a while), see the Quick and dirty version control and Git introduction section.

Tim Pope's vim-fugitive is a plugin that makes sure you don't need to leave Vim to interact with Git. Since you're editing the files in Vim, you might as well take care of dealing with version control of said edits in the editor. The plugin is available from https://github.com/tpope/vim-fugitive.

If you're using vim-plug, you can install vim-fugitive by adding Plug 'tpope/vim-fugitive' to your .vimrc file and running :w | source $MYVIMRC | PlugInstall.

A lot of the commands vim-fugitive provides are a mirror of external Git ...

Get Mastering Vim now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.