OSDN Git Service

Regular updates
[twpd/master.git] / tig.md
1 ---
2 title: Tig
3 category: Git
4 layout: 2017/sheet
5 updated: 2017-08-29
6 weight: -3
7 ---
8
9 ### Installing
10
11 ```bash
12 # MacOS + Homebrew
13 $ brew install tig --HEAD
14 ```
15
16 ```bash
17 # Ubuntu
18 $ sudo apt install tig
19 ```
20
21 ### Invocation
22
23 | Command             | Description                                  |
24 | ---                 | ---                                          |
25 | `tig`               |                                              |
26 | ---                 | ---                                          |
27 | `tig status`        | Status                                       |
28 | `tig blame FILE`    | Blame                                        |
29 | ---                 | ---                                          |
30 | `tig master`        | Show a branch                                |
31 | `tig test..master`  | Show difference between two branches         |
32 | `tig FILE`          | Show history of file                         |
33 | `tig v0.0.3:README` | Show contents of file in a specific revision |
34
35 You can substitute `git log` → `tig`.
36
37 ## Shortcut keys
38 {: .-three-column}
39
40 ### Switching views
41
42 | `m` | Main view |
43 | `s` | Status |
44 | `t` | Tree (files) |
45 | `y` | Stash view |
46 | `g` | Grep |
47 | `h` | Help |
48 {: .-shortcuts}
49
50 ### All views
51
52 | Shortcut | Description             |
53 | ---      | ---                     |
54 | `j`  `k` | Up/down                 |
55 | `J`  `K` | Next/previous           |
56 | ---      | ---                     |
57 | `<`      | Back                    |
58 | `R`      | Refresh                 |
59 | `q`      | Close                   |
60 | `Q`      | Close all               |
61 | ---      | ---                     |
62 | `^N`     | Next on parent view     |
63 | `^P`     | Previous on parent view |
64 {: .-shortcuts}
65
66 ### `m` - Main view
67
68 | `D` | Toggle date display modes   |
69 | `A` | Toggle author display modes |
70 | `X` | Toggle commit sha           |
71 | `C` | Cherry pick a commit        |
72 {: .-shortcuts}
73
74 ### `s` - Stage view
75
76 | `u`     | Stage/unstage file or chunk        |
77 | `!`     | Revert file or chunk               |
78 | `C`     | Commit                             |
79 | `M`     | Merge                              |
80 | `1`     | Stage line                         |
81 | `[` `]` | Increase/decrease the diff context |
82 {: .-shortcuts}
83
84 ### `h` - Branch view
85
86 | `i` | Change sort header |
87 {: .-shortcuts}
88
89 ### `h` - Blame view
90
91 | `,` | Parent commit |
92 {: .-shortcuts}