Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim:Fugitive:Glog - How to get commits for current file rather than revisions

Currently, if I type :Glog I get the list of revisions for the current file.

If I type :Glog -- I get the list of commits for all files.

What do I need to type to get the of commits for the current file?

like image 337
Kyle Heironimus Avatar asked Sep 20 '13 19:09

Kyle Heironimus


3 Answers

For sake of completeness, once you have the revisions loaded in your buffer, you can browse through them by opening the quickfix list

:Glog -- %
:copen

Load the last 10 commits for the current file

:Glog -10 -- %
like image 122
lsaffie Avatar answered Nov 02 '22 03:11

lsaffie


I figured it out. I found it here.

:Glog -- %
like image 42
Kyle Heironimus Avatar answered Nov 02 '22 03:11

Kyle Heironimus


I use

:0Gclog

It puts the commits history of current file into quick fix so that you can use ]q or [q to go through them

Note that the usage supports range: :{range}Gclog. So you can use any range, e.g. :1Gclog or use a visual mapping:

vmap <leader>gl :Gclog<CR>
like image 5
nemo Avatar answered Nov 02 '22 03:11

nemo