Show Menu
Cheatography

fugitive Keyboard Shortcuts by

Whenever you edit a file from a Git repository, a set of commands is defined that serve as a gateway to Git.

Navigation (open)

<cr>
Open the file or
fugiti­ve-­object
under the cursor.
o
Open the file or
fugiti­ve-­object
under the cursor in a new split.
gO
Open the file or
fugiti­ve-­object
under the cursor in a new vertical split.
O
Open the file or
fugiti­ve-­object
under the cursor in a new tab.
p
Open the file or
fugiti­ve-­object
under the cursor in a preview window.
~
Open the current file in the
[count]th
first ancestor.
P
Open the current file in the
[count]th
parent.
C
Open the commit containing the current file.
gi
Open .git/i­nfo­/ex­clude in a split. Use a count to open .gitig­nore.

Navigation (jump to file)

gu
Jump to file [count] in the "­Unt­rac­ked­" or "­Uns­tag­ed" section.
gU
Jump to file [count] in the "­Uns­tag­ed" section.
gs
Jump to file [count] in the "­Sta­ged­" section.
gp
Jump to file [count] in the "­Unp­ush­ed" section.
gP
Jump to file [count] in the "­Unp­ull­ed" section.
gr
Jump to file [count] in the "­Reb­asi­ng" section.

Stagin­g/u­nst­aging

s
Stage (add) the file or hunk under the cursor.
u
Unstage (reset) the file or hunk under the cursor.
-
Stage or unstage the file or hunk under the cursor.
U
Unstage everyt­hing.
X
Discard the change under the cursor
=
Toggle an inline diff of the file under the cursor.
>
Insert an inline diff of the file under the cursor.
<
Remove the inline diff of the file under the cursor.
gI
Open
.git/i­nfo­/ex­clude
in a split and add the file under the cursor.
I
Invoke
:Git add --patch
or
reset --patch
on the file under the cursor.
P
On untracked files, this instead calls
:Git add --inte­nt-­to-add
.

Checko­ut/­branch

coo
Check out the commit under the cursor.
cb<­Spa­ce>
Populate command line with
":Git branch "
.
co<­Spa­ce>
Populate command line with
":Git checkout "
.
cb?
Show this help.
co?
Same as "
cb?
"

Stash

czz
Push stash. Pass a [count] of 1 to add
--incl­ude­-un­tracked
or 2 to add
--all
.
czw
Push stash of worktree. Like
czz
with
--keep­-index
.
czA
Apply topmost stash, or stash@­{co­unt}.
cza
Apply topmost stash, or stash@­{co­unt}, preserving the index.
czP
Pop topmost stash, or stash@­{co­unt}.
czp
Pop topmost stash, or stash@­{co­unt}, preserving the index.
cz<­spa­ce>
Populate command line with
":Git stash "
.
cz?
Show this help.

Rebase

ri
Perform an intera­ctive rebase.
u
Same as "
ri
"
rf
Perform an autosquash rebase without editing the todo list.
ru
Perform an intera­ctive rebase against @{upst­ream}.
rp
Perform an intera­ctive rebase against @{push}.
rr
Continue the current rebase.
rs
Skip the current commit and continue the current rebase.
ra
Abort the current rebase.
re
Edit the current rebase todo list.
rw
Perform an intera­ctive rebase with the commit under the cursor set to
reword
.
rm
Perform an intera­ctive rebase with the commit under the cursor set to
edit
.
rd
Perform an intera­ctive rebase with the commit under the cursor set to
drop
.
r<s­pac­e>
Populate command line with
":Git rebase "
.
r?
Show this help.
 

Navigation (jump)

(
Jump to the previous file, hunk, or revision.
)
Jump to the next file, hunk, or revision.
[c
Jump to previous hunk, expanding inline diffs automa­tic­ally.
]c
Jump to next hunk, expanding inline diffs automa­tic­ally.
[/
Jump to previous file, collapsing inline diffs automa­tic­ally.
[m
Same as "
[/
"
]/
Jump to next file, collapsing inline diffs automa­tic­ally.
]m
Same as "
]/
"
i
Jump to the next file or hunk, expanding inline diffs automa­tic­ally.
[[
Jump [count] sections backward.
]]
Jump [count] sections forward.
[]
Jump [count] section ends backward.
][
Jump [count] section ends forward.
*
On the first column of a + or - diff line, search for the corres­ponding - or + line.
#
Same as "­*", but search backward.

Diff

dp
Invoke
:Git
diff on the file under the cursor.
dd
Perform a
:Gdiff­split
on the file under the cursor.
dv
Perform a
:Gvdif­fsplit
on the file under the cursor.
ds
Perform a
:Ghdif­fsplit
on the file under the cursor.
dh
Perform a
:Ghdif­fsplit
on the file under the cursor.
dq
Close all but one diff buffer, and
:diffoff
! the last one.
d?
Show this help.

Commit

cc
Create a commit.
ca
Amend the last commit and edit the message.
ce
Amend the last commit without editing the message.
cw
Reword the last commit.
cvc
Create a commit with -v.
cva
Amend the last commit with -v
crc
Revert the commit under the cursor.
crn
Revert the commit under the cursor in the index and work tree, but do not actually commit the changes.
c?
Show this help.

Commit (comma­nd-­line)

c<s­pac­e>
Populate command line with
":Git commit "
.
cr<­spa­ce>
Populate command line with
":Git revert "
.
cm<­spa­ce>
Populate command line with
":Git merge "
.

Commit (create a...)

cf
Create a
fixup!
commit for the commit under the cursor.
cF
Create a
fixup!
commit for the commit under the cursor and immedi­ately rebase it.
cs
Create a
squash!
commit for the commit under the cursor.
cS
Create a
squash!
commit for the commit under the cursor and immedi­ately rebase it.
cA
Create a
squash!
commit for the commit under the cursor and edit the message.

Miscel­laneous

gq
Close the status buffer.
.
Start a
:
command line with the file under the cursor prepop­ulated.
g?
Show help for
fugiti­ve-maps

Global

<c-­r><­c-g>
On the command line, recall the path to the current
fugiti­ve-­object
["x]­y<c­-g>
Yank the path to the current
fugiti­ve-­object
.
   
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Git Cheat Sheet

          More Cheat Sheets by isaacnewton

          sc-im Cheat Sheet