$ sudo apt-get install tig or Download $ make prefix=/usr/local $ sudo make install prefix=/usr/local
- tig
git log | tig
git diff | tig - tig
h : help
d : show diff view (可用diff-highlight)
s : show status view (u: stage/unstage )
c : show stage view
y : show stash view
r : show refs view (可看到tag)
g : show grep view
t : show tree view
l : show git log
r : show branch/tag - shift + a : author格式切換
- shift + d : 日期格式切換
- shift + g : commit graph (line) 切換
- shift + ' : commit graph (point)切換
- / : search
- ? : search back
- t : tree view (Enter 進入,, 上一層)
(Enter後)
[ : set diff-context 減少
] : set diff-context 增加
j/k : 單行上下移動
PgUp/PgDn : page 上下移動 - b : tree mode,選檔案後選某一行程式碼,就知道是哪個commit提交
- R : 更新頁面 (如果tig沒關掉,而另個terminal在操作時)
- 在其它的 view 可以用大寫 S 切換到 status view,然後就能用 u 來把檔案加入或移出這次的 commit,或是對檔案按 enter 查看 diff 變更,此時可以用 @ 往下選 chunk,再按 u 來只加入選中的 chunk,或是用 j/k 上下移動,按數字 1 來只加入單行的修改,最後按 q 跳出 diff 再按下大寫 C 就能 git commit 了。
~/.tigrc
#at /usr/local/bin/diff-highlight
set diff-highlight = true
# ! Run the command in the foreground with output shown.
# @ Run the command in the background with no output.
# ? Prompt the user before executing the command.
# checkout file
bind status O ?@git checkout -- %(file)
bind status C !git commit -v
ref:
1. jonas/tigrc
2. The Tig Manual
3. WMの物語
4. Fix-up Git commits with Tig
5. 簡易tig指令
沒有留言:
張貼留言