sponsor Vim development Vim logo Vim Book Ad

vim-git-log : View your git log interactively in Vim.  Side by side diffs!

 script karma  Rating 5/2, Downloaded by 896  Comments, bugs, improvements  Vim wiki

created by
eric johnson
 
script type
utility
 
description
vim-git-log is a Vim plugin that helps browse your git log.  This plugin
requires [Fugitive](https://github.com/tpope/vim-fugitive).

See the git repo here: https://github.com/kablamo/vim-git-log

GitLog
-------------

To open a new buffer which displays a list of the changes in your git repo:

    :GitLog

This plugin is basically a wrapper around `git log` so nearly any option or
argument that you can use with `git log` can be used here.  The exceptions are
--pretty and options that affect --pretty.  Here are some more examples:

View changes from the 'lib' directory instead of the repository root:

    :GitLog lib

View changes from a specifi author/committer:

    :GitLog --author Batman

View changes where the commit message matches a (PCRE) regular expression

    :GitLog --grep 'dinosaurs'

View changes for a date range

    :GitLog --since yesterday
    :GitLog --since '1 month 1 week 1 day 1 hour 1 second'
    :GitLog --since 2012-12-31
    :GitLog --until 2012-12-31 23:30:60
    :GitLog <since>..<until>


How to use the log browser
--------------------------

Running any of the above commands will open a window titled 'GitLog' that looks
like this and allows you to browse the git log:

    Eric Johnson 4 weeks ago 5ef0fb2
    Added daysPerYear.
    lib/Networth/Controller/Calculator.pm
    lib/Networth/Out/RealCost.pm
    root/html/calculator/realCost.tt

    Eric Johnson 5 weeks ago 9595fa0
    fix css margin class.
    root/css/networth.css
    root/css/style.less
    root/css/style.less.old
    root/html/calculator/realCost.tt
    root/html/fi.tt

    Eric Johnson 6 weeks ago ecf43db
    Css tweaks.
    root/html/calculator/realCost.tt

Here are some commands you can use in the browser:

   <cr>  View the side by side diff of any file by putting your cursor on that
         line and typing `d` (for diff).

   d     This has the same behavior as `<cr>`.

   n     Move your cursor to the first filename in the next commit.

   N     Move your cursor to the first filename in the previous commit.


To quickly exit out of the diff and return to the 'GitLog' window, type `q`.


Ribbon
-------------

**First** mark your place with

    :RibbonSave

This will place a tag named __ribbon at origin/master.  Basically you are
bookmarking our current spot with a `ribbon`.

**Next**, use Fugitive to pull down the latest changes made by your fellow conspirators from the
remote repository.  

    :Git pull

To review those changes use the following command:

    :Ribbon

This will open a window titled 'Ribbon' that looks like this:

    Eric Johnson 6 weeks ago ecf43db
    Css tweaks.
    root/html/calculator/realCost.tt

    Eric Johnson 5 weeks ago 9595fa0
    fix css margin class.
    root/css/networth.css
    root/css/style.less
    root/css/style.less.old
    root/html/calculator/realCost.tt
    root/html/fi.tt

    Eric Johnson 4 weeks ago 5ef0fb2
    Added daysPerYear.
    lib/Networth/Controller/Calculator.pm
    lib/Networth/Out/RealCost.pm
    root/html/calculator/realCost.tt

See the section on *How to use the GitLog browser* for a complete list of all
the commands available to you.

**Finally**, after you have reviewed all the changes, mark your place again with:

    :RibbonSave

Bonus tips
----------

The default colors used in vimdiff look like they were created by crazy clowns.
You might like my colorscheme instead:

    ⚡ mkdir -p ~/.vim/colors/
    ⚡ wget https://github.com/kablamo/dotfiles/blob/master/links/.vim/colors/iijo.vim -O ~/tmp/iijo.vim
    ⚡ echo "colorscheme iijo" >> ~/.vimrc

How to use vimdiff:
- To switch windows type `ctl-w l` and `ctl-w h`.  For more help see `:help window-move-cursor`.
- To open and close folds type `zo` and `zc`.  For more help see `:help fold-commands`.

See also
--------

This script was inspired by
http://gitready.com/advanced/2011/10/21/ribbon-and-catchup-reading-new-commits.html

I also wrote [git-ribbon](https://github.com/kablamo/git-ribbon), a little Perl
script that does pretty much the same thing but from the commandline.
 
install details
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-git-log-master.zip 0.01 2013-03-23 7.0 eric johnson Initial upload
ip used for rating: 44.220.184.63

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github