Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tig cheatsheet #1918

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 80 additions & 34 deletions tig.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Tig
category: Git
layout: 2017/sheet
updated: 2018-11-16
updated: 2022-12-08
weight: -3
---

Expand All @@ -22,7 +22,7 @@ $ sudo apt install tig

| Command | Description |
| ------------------- | -------------------------------------------- |
| `tig` | |
| `tig` | Logs |
| --- | --- |
| `tig status` | Status |
| `tig blame FILE` | Blame |
Expand All @@ -40,54 +40,100 @@ You can substitute `git log` → `tig`.

### Switching views

| `m` | Main view |
| `s` | Status |
| `t` | Tree (files) |
| `y` | Stash view |
| `g` | Grep |
| `h` | Help |
| Shortcut | Description |
| -------- | ------------ |
| `m` | Main view |
| `d` | Diff |
| `t` | Tree (files) |
| `b` | Blame |
| `s` | Status |
| `c` | Stage |
| `y` | Stash |
| `g` | Grep |
| `h` | Help |
{: .-shortcuts}

### All views

| Shortcut | Description |
| --- | --- |
| `j` `k` | Up/down |
| `J` `K` | Next/previous |
| --- | --- |
| `<` | Back |
| `R` | Refresh |
| `q` | Close |
| `Q` | Close all |
| --- | --- |
| `^N` | Next on parent view |
| `^P` | Previous on parent view |
| Shortcut | Description |
| --- | --- |
| `<enter>` | Enter and open selected line |
| `<` | Back to previous view state |
| `<tab>` | Move focus to next view |
| `R` | Refresh |
| `q` | Close view |
| `Q` | Close all (quit) |
| `,` | Parent commit |
{: .-shortcuts}

### Cursor navigation

| Shortcut | Description |
| --- | --- |
| `/` | Search |
| `?` | Search backwards |
| `j` `k` | Up/down |
| `J` `K` | Next/previous |
| `<space>` | Page down |
| `-` | Page up |
| `^D` | Half page down |
| `^U` | Half page up |
{: .-shortcuts}

### Option toggles

| Shortcut | Description |
| --- | --- |
| `I` | Toggle sort order modes |
| `i` | Change sort header |
| `D` | Toggle date display modes |
| `A` | Toggle author display modes |
| `#` | Toggle line numbers |
| `~` | Toggle line graphics |
| `F` | Toggle file names |
| `W` | Toggle ignore space |
{: .-shortcuts}

### `m` - Main view

| `D` | Toggle date display modes |
| `A` | Toggle author display modes |
| `X` | Toggle commit sha |
| `C` | Cherry pick a commit |
| Shortcut | Description |
| --- | --- |
| `X` | Toggle commit sha |
| `C` | Cherry pick a commit |
{: .-shortcuts}

### `s` - Status view
| Shortcut | Description |
| --- | --- |
| `u` | Stage/unstage file or chunk |
| `!` | Revert file or chunk |
| `C` | Commit |
| `M` | Merge with external tool |
{: .-shortcuts}

### `c` - Stage view

| `u` | Stage/unstage file or chunk |
| `!` | Revert file or chunk |
| `C` | Commit |
| `M` | Merge |
| `1` | Stage line |
| `[` `]` | Increase/decrease the diff context |
| Shortcut | Description |
| --- | --- |
| `u` | Stage/unstage file or chunk |
| `!` | Revert file or chunk |
| `1` | Stage line |
| `\` | Split current diff hunk |
| `[` `]` | Increase/decrease the diff context |
{: .-shortcuts}

### `h` - Branch view
### `d` - Diff view

| `i` | Change sort header |
| Shortcut | Description |
| --- | --- |
| `[` `]` | Increase/decrease the diff context |
{: .-shortcuts}

### `h` - Blame view
### `y` - Stash view

| `,` | Parent commit |
| Shortcut | Description |
| --- | --- |
| `A` | Apply selected stash |
| `P` | Pop selected stash |
| `!` | Drop selected stash |
{: .-shortcuts}