Installing

# MacOS + Homebrew
$ brew install tig --HEAD
# Ubuntu
$ sudo apt install tig

Invocation

CommandDescription
tigLogs
tig statusStatus
tig blame FILEBlame
tig masterShow a branch
tig test..masterShow difference between two branches
tig FILEShow history of file
tig v0.0.3:READMEShow contents of file in a specific revision
tig -C /repo/pathRun in dir /repo/path (like git -C)

You can substitute git log → tig.

Shortcut keys

Switching views

ShortcutDescription
mMain view
dDiff
tTree (files)
bBlame
sStatus
cStage
yStash
gGrep
hHelp

All views

ShortcutDescription
<enter>Enter and open selected line
<Back to previous view state
<tab>Move focus to next view
RRefresh
qClose view
QClose all (quit)
,Parent commit

Cursor navigation

ShortcutDescription
/Search
?Search backwards
j kUp/down
J KNext/previous
<space>Page down
-Page up
^DHalf page down
^UHalf page up

Option toggles

ShortcutDescription
IToggle sort order modes
iChange sort header
DToggle date display modes
AToggle author display modes
#Toggle line numbers
~Toggle line graphics
FToggle file names
WToggle ignore space

m - Main view

ShortcutDescription
XToggle commit sha
CCherry pick a commit

s - Status view

ShortcutDescription
uStage/unstage file or chunk
!Revert file or chunk
CCommit
MMerge with external tool

c - Stage view

ShortcutDescription
uStage/unstage file or chunk
!Revert file or chunk
1Stage line
\Split current diff hunk
[ ]Increase/decrease the diff context

d - Diff view

ShortcutDescription
[ ]Increase/decrease the diff context

y - Stash view

ShortcutDescription
AApply selected stash
PPop selected stash
!Drop selected stash
0 Comments for this cheatsheet. Write yours!