I am editing files opened split into three windows. I want to commit those into the repository. Is there any commands to do that?
There are a few ways to accomplish this task. I will outline the most interactive method which uses :Gstatus
.
:Gstatus
<c-n>
/<c-p>
-
cc
whilst in the status window:x
)zj
and zk
to move between sections-
on a section will stage/unstage all the files in that sectionFor more help with :Gstatus
see :h :Gstatus
or g?
when in the :Gstatus
buffer.
Can use :Gwrite
and :windo
to skip the :Gstatus
window to make this a bit faster.
:windo Gw
:Gcommit
You can also skip the whole commit window by using the -m
flag. e.g. :Gcommit -m "A short message"
I recommend Vimcasts videos on Fugitive: The Fugitive Series - a retrospective
To learn more see:
:h fugitive
:h :Gstatus
:h :Gw
:h :Gcommit
:h :windo
:h :x