<commit_before>---
title: Tig
category: Git
layout: 2017/sheet
updated: 201708.29
weight: -3
---

### Installing

```bash
# MacOS + Homebrew
$ brew install tig --HEAD
```

```bash
# Ubuntu
$ sudo apt install tig
```

### Invocation

| Command             | Description                                  |
| ---                 | ---                                          |
| `tig`               |                                              |
| ---                 | ---                                          |
| `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 |

You can substitute `git log` → `tig`.

## Shortcut keys
{: .-three-column}

### Switching views

| `m` | Main view |
| `s` | Status |
| `t` | Tree (files) |
| `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 |
{: .-shortcuts}

### `m` - Main view

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

### `s` - Stage view

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

### `h` - Branch view

| `i` | Change sort header |
{: .-shortcuts}<commit_msg>tig: remove shifts<commit_after>---
title: Tig
category: Git
layout: 2017/sheet
updated: 201708.29
weight: -3
---

### Installing

```bash
# MacOS + Homebrew
$ brew install tig --HEAD
```

```bash
# Ubuntu
$ sudo apt install tig
```

### Invocation

| Command             | Description                                  |
| ---                 | ---                                          |
| `tig`               |                                              |
| ---                 | ---                                          |
| `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 |

You can substitute `git log` → `tig`.

## Shortcut keys
{: .-three-column}

### Switching views

| `m` | Main view |
| `s` | Status |
| `t` | Tree (files) |
| `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 |
{: .-shortcuts}

### `m` - Main view

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

### `s` - Stage view

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

### `h` - Branch view

| `i` | Change sort header |
{: .-shortcuts}
{'fraction_non_alphanumeric': 0.14866310160427806, 'fraction_numerical': 0.007272727272727273, 'mean_word_length': 0.904684317718941, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1471478', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1308, 'n_words': 347}