Update tig cheatsheet (#1918)

* Update tig cheatsheet

The last update was in 2018, and some shortcuts were wrong, and many
were missing. This update adds the most pertinent shortcuts in the most
used tig views. This update matches tig version 2.4.1.

* Fix build

Co-authored-by: Rico Sta. Cruz <rstacruz@users.noreply.github.com>
This commit is contained in:
Dimi Shahbaz 2022-12-22 15:07:57 -08:00 committed by GitHub
parent 83017d313e
commit 58a1129c9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 81 additions and 35 deletions

84
tig.md
View File

@ -2,7 +2,7 @@
title: Tig title: Tig
category: Git category: Git
layout: 2017/sheet layout: 2017/sheet
updated: 2018-11-16 updated: 2022-12-08
weight: -3 weight: -3
--- ---
@ -22,7 +22,7 @@ $ sudo apt install tig
| Command | Description | | Command | Description |
| ------------------- | -------------------------------------------- | | ------------------- | -------------------------------------------- |
| `tig` | | | `tig` | Logs |
| --- | --- | | --- | --- |
| `tig status` | Status | | `tig status` | Status |
| `tig blame FILE` | Blame | | `tig blame FILE` | Blame |
@ -40,10 +40,15 @@ You can substitute `git log` → `tig`.
### Switching views ### Switching views
| Shortcut | Description |
| -------- | ------------ |
| `m` | Main view | | `m` | Main view |
| `s` | Status | | `d` | Diff |
| `t` | Tree (files) | | `t` | Tree (files) |
| `y` | Stash view | | `b` | Blame |
| `s` | Status |
| `c` | Stage |
| `y` | Stash |
| `g` | Grep | | `g` | Grep |
| `h` | Help | | `h` | Help |
{: .-shortcuts} {: .-shortcuts}
@ -52,42 +57,83 @@ You can substitute `git log` → `tig`.
| Shortcut | Description | | 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` | Up/down |
| `J` `K` | Next/previous | | `J` `K` | Next/previous |
| `<space>` | Page down |
| `-` | Page up |
| `^D` | Half page down |
| `^U` | Half page up |
{: .-shortcuts}
### Option toggles
| Shortcut | Description |
| --- | --- | | --- | --- |
| `<` | Back | | `I` | Toggle sort order modes |
| `R` | Refresh | | `i` | Change sort header |
| `q` | Close | | `D` | Toggle date display modes |
| `Q` | Close all | | `A` | Toggle author display modes |
| --- | --- | | `#` | Toggle line numbers |
| `^N` | Next on parent view | | `~` | Toggle line graphics |
| `^P` | Previous on parent view | | `F` | Toggle file names |
| `W` | Toggle ignore space |
{: .-shortcuts} {: .-shortcuts}
### `m` - Main view ### `m` - Main view
| `D` | Toggle date display modes | | Shortcut | Description |
| `A` | Toggle author display modes | | --- | --- |
| `X` | Toggle commit sha | | `X` | Toggle commit sha |
| `C` | Cherry pick a commit | | `C` | Cherry pick a commit |
{: .-shortcuts} {: .-shortcuts}
### `s` - Status view ### `s` - Status view
| Shortcut | Description |
| --- | --- |
| `u` | Stage/unstage file or chunk | | `u` | Stage/unstage file or chunk |
| `!` | Revert file or chunk | | `!` | Revert file or chunk |
| `C` | Commit | | `C` | Commit |
| `M` | Merge | | `M` | Merge with external tool |
{: .-shortcuts}
### `c` - Stage view
| Shortcut | Description |
| --- | --- |
| `u` | Stage/unstage file or chunk |
| `!` | Revert file or chunk |
| `1` | Stage line | | `1` | Stage line |
| `\` | Split current diff hunk |
| `[` `]` | Increase/decrease the diff context | | `[` `]` | Increase/decrease the diff context |
{: .-shortcuts} {: .-shortcuts}
### `h` - Branch view ### `d` - Diff view
| `i` | Change sort header | | Shortcut | Description |
| --- | --- |
| `[` `]` | Increase/decrease the diff context |
{: .-shortcuts} {: .-shortcuts}
### `h` - Blame view ### `y` - Stash view
| `,` | Parent commit | | Shortcut | Description |
| --- | --- |
| `A` | Apply selected stash |
| `P` | Pop selected stash |
| `!` | Drop selected stash |
{: .-shortcuts} {: .-shortcuts}