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 list of commits for the current file?
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 list of commits for the current file?
I figured it out. I found it here.
:Glog -- %
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 -- %
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>
:0Gclog
populated the quickfix list with the log history and :1Gclog
, :2Gclog
etc populated it with the first commit ever. –
Amylase 0
represents the whole file. Use :help :Gclog
for the official description. –
Servitude :0Gclog
, you can use dd
to get a diff between the current commit and the previous one. See also this. –
Ticktock I figured it out. I found it here.
:Glog -- %
:Git log -- %
I also like adding -p
/--patch
to see exactly what was changed.
© 2022 - 2024 — McMap. All rights reserved.