2013-10-14 02:36:58 +00:00
|
|
|
---
|
|
|
|
title: Tig
|
2015-11-24 04:48:01 +00:00
|
|
|
category: Git
|
2022-12-22 23:07:57 +00:00
|
|
|
updated: 2022-12-08
|
2017-08-29 16:57:42 +00:00
|
|
|
weight: -3
|
2013-10-14 02:36:58 +00:00
|
|
|
---
|
2012-03-16 06:14:31 +00:00
|
|
|
|
2012-03-16 06:40:21 +00:00
|
|
|
### Installing
|
|
|
|
|
2017-08-29 16:57:42 +00:00
|
|
|
```bash
|
|
|
|
# MacOS + Homebrew
|
|
|
|
$ brew install tig --HEAD
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Ubuntu
|
|
|
|
$ sudo apt install tig
|
|
|
|
```
|
2012-03-16 06:40:21 +00:00
|
|
|
|
|
|
|
### Invocation
|
2012-03-16 06:14:31 +00:00
|
|
|
|
2017-08-29 16:57:42 +00:00
|
|
|
| Command | Description |
|
2020-08-03 12:36:55 +00:00
|
|
|
| ------------------- | -------------------------------------------- |
|
2022-12-22 23:07:57 +00:00
|
|
|
| `tig` | Logs |
|
2017-08-29 16:57:42 +00:00
|
|
|
| --- | --- |
|
|
|
|
| `tig status` | Status |
|
|
|
|
| `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 |
|
2020-08-03 12:36:55 +00:00
|
|
|
| `tig -C /repo/path` | Run in dir `/repo/path` (like `git -C`) |
|
2017-08-29 16:57:42 +00:00
|
|
|
|
|
|
|
You can substitute `git log` → `tig`.
|
|
|
|
|
|
|
|
## Shortcut keys
|
|
|
|
{: .-three-column}
|
2013-08-24 07:43:10 +00:00
|
|
|
|
2017-08-29 16:57:42 +00:00
|
|
|
### Switching views
|
2013-08-24 07:43:10 +00:00
|
|
|
|
2022-12-22 23:07:57 +00:00
|
|
|
| Shortcut | Description |
|
|
|
|
| -------- | ------------ |
|
|
|
|
| `m` | Main view |
|
|
|
|
| `d` | Diff |
|
|
|
|
| `t` | Tree (files) |
|
|
|
|
| `b` | Blame |
|
|
|
|
| `s` | Status |
|
|
|
|
| `c` | Stage |
|
|
|
|
| `y` | Stash |
|
|
|
|
| `g` | Grep |
|
|
|
|
| `h` | Help |
|
2017-08-29 16:57:42 +00:00
|
|
|
{: .-shortcuts}
|
2012-03-16 06:14:31 +00:00
|
|
|
|
2012-03-16 06:40:21 +00:00
|
|
|
### All views
|
|
|
|
|
2022-12-22 23:07:57 +00:00
|
|
|
| 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 |
|
2017-08-29 16:57:42 +00:00
|
|
|
{: .-shortcuts}
|
2012-03-16 06:14:31 +00:00
|
|
|
|
2012-03-16 06:40:21 +00:00
|
|
|
### `m` - Main view
|
2012-03-16 06:14:31 +00:00
|
|
|
|
2022-12-22 23:07:57 +00:00
|
|
|
| Shortcut | Description |
|
|
|
|
| --- | --- |
|
|
|
|
| `X` | Toggle commit sha |
|
|
|
|
| `C` | Cherry pick a commit |
|
2017-08-29 16:57:42 +00:00
|
|
|
{: .-shortcuts}
|
2012-03-16 06:14:31 +00:00
|
|
|
|
2021-02-03 00:25:01 +00:00
|
|
|
### `s` - Status view
|
2023-01-02 10:28:24 +00:00
|
|
|
|
2022-12-22 23:07:57 +00:00
|
|
|
| Shortcut | Description |
|
|
|
|
| --- | --- |
|
|
|
|
| `u` | Stage/unstage file or chunk |
|
|
|
|
| `!` | Revert file or chunk |
|
|
|
|
| `C` | Commit |
|
|
|
|
| `M` | Merge with external tool |
|
|
|
|
{: .-shortcuts}
|
|
|
|
|
|
|
|
### `c` - Stage view
|
2012-03-16 06:14:31 +00:00
|
|
|
|
2022-12-22 23:07:57 +00:00
|
|
|
| Shortcut | Description |
|
|
|
|
| --- | --- |
|
|
|
|
| `u` | Stage/unstage file or chunk |
|
|
|
|
| `!` | Revert file or chunk |
|
|
|
|
| `1` | Stage line |
|
|
|
|
| `\` | Split current diff hunk |
|
|
|
|
| `[` `]` | Increase/decrease the diff context |
|
2017-08-29 16:57:42 +00:00
|
|
|
{: .-shortcuts}
|
2012-03-16 06:14:31 +00:00
|
|
|
|
2022-12-22 23:07:57 +00:00
|
|
|
### `d` - Diff view
|
2012-03-16 06:14:31 +00:00
|
|
|
|
2022-12-22 23:07:57 +00:00
|
|
|
| Shortcut | Description |
|
|
|
|
| --- | --- |
|
|
|
|
| `[` `]` | Increase/decrease the diff context |
|
2017-08-29 16:57:42 +00:00
|
|
|
{: .-shortcuts}
|
2017-08-29 21:24:00 +00:00
|
|
|
|
2022-12-22 23:07:57 +00:00
|
|
|
### `y` - Stash view
|
2017-08-29 21:24:00 +00:00
|
|
|
|
2022-12-22 23:07:57 +00:00
|
|
|
| Shortcut | Description |
|
|
|
|
| --- | --- |
|
|
|
|
| `A` | Apply selected stash |
|
|
|
|
| `P` | Pop selected stash |
|
|
|
|
| `!` | Drop selected stash |
|
2017-08-29 21:24:00 +00:00
|
|
|
{: .-shortcuts}
|