Getting started
Introduction
Tig is a terminal browser for Git repositories and history.
- Tig website (jonas.github.io)
- Tig manual (jonas.github.io)
- tigrc configuration (jonas.github.io)
Installing
Invocation
| Command | Description |
|---|---|
tig | Logs |
tig status | Status |
tig log | Log messages and diffstat |
tig blame FILE | Blame |
tig master | Show a branch |
tig test..master | Show difference between two branches |
tig FILE | Show history of file |
tig v0.0.3:README | Show contents of file in a specific revision |
tig -C /repo/path | Run in dir /repo/path (like git -C) |
tig refs | Branches, remotes, tags |
tig stash | Stashes |
You can substitute git log → tig.
Shortcut keys
Switching views
| Shortcut | Description |
|---|---|
m | Main view |
d | Diff |
l | Log |
t | Tree (files) |
b | Blame |
s | Status |
c | Stage |
y | Stash |
g | Grep |
p | Pager |
f | Blob (file) |
r | Refs |
h | Help |
See: View switching
All views
| Shortcut | Description |
|---|---|
<enter> | Open selected line |
<tab> | Move focus to next view |
R | Refresh |
O | Maximize current view |
q | Close view |
Q | Close all (quit) |
, | Move to parent |
See: View manipulation
Cursor navigation
| Shortcut | Description |
|---|---|
/ | Search |
? | Search backwards |
n N | Next/previous match |
j k | Up/down |
<home> | First line |
<end> | Last line |
<space> | Page down |
- | Page up |
See: Cursor navigation
Option toggles
| Shortcut | Description |
|---|---|
o | Open option menu |
D | Toggle date display modes |
A | Toggle author display modes |
G | Toggle revision graph |
# | Toggle line numbers |
~ | Toggle line graphics |
F | Toggle ref names |
W | Toggle ignore whitespace |
X | Toggle commit ID |
See: Miscellaneous keys
m - Main view
| Shortcut | Description |
|---|---|
C | Cherry-pick selected commit |
H | Go to HEAD |
s - Status view
| Shortcut | Description |
|---|---|
u | Stage/unstage file or chunk |
! | Revert file or chunk |
C | Commit |
M | Merge with external tool |
c - Stage view
| Shortcut | Description |
|---|---|
u | Stage/unstage file or chunk |
! | Revert file or chunk |
1 | Stage line |
@ | Next diff chunk |
[ ] | Increase/decrease the diff context |
d - Diff view
| Shortcut | Description |
|---|---|
[ ] | Increase/decrease the diff context |
y - Stash view
# ~/.tigrc
bind stash A !git stash apply %(stash)
bind stash P !git stash pop %(stash)
bind stash ! !git stash drop %(stash)
Tig already binds A/P/! to apply, pop, and drop with a confirmation prompt; these bindings skip that prompt.
See: bind command
0 Comments for this cheatsheet. Write yours!