Communitygithub.com

G1Joshi/Agent-Skills

專業的 Tig 輔助,涵蓋 Git 文字模式介面、互動式暫存、提交圖譜視覺化、差異探索與 blame 導航。在終端機中瀏覽 Git 提交歷史、互動式暫存區塊、檢視檔案變更或審核修訂版本時使用。

Agent-Skills 是什麼?

此技能專為需要在終端機環境中高效使用 Git 的開發者或 AI 代理所設計,主要圍繞 Tig 這套基於 ncurses 的 Git 文字模式介面。它能讓使用者在無 GUI 的環境下,快速瀏覽提交圖譜、分支與標籤,並進行互動式暫存與區塊提交,無需離開終端機。技能支援 Tig 的核心功能,包括 `tig blame` 逐行審查程式碼作者與提交記錄、`tig status` 進行精細的差異審閱與暫存,以及自訂 `~/.tigrc` 設定檔來優化按鍵綁定與版面配置。此技能提供從快速入門指令、導航按鍵、生產環境設定到進階除錯模式的完整指引,涵蓋 Vim 風格按鍵綁定、互動式暫存區塊操作,以及 `tig blame` 的向前追溯導航。此外,也包含常見工作模式如自訂快速提交與推送的按鍵綁定,以及針對大型儲存庫、色彩衝突和子模組路徑問題的疑難排解建議,是進行低開銷 Git 審計與終端機式版本控制的必備工具。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/G1Joshi/Agent-Skills/tree/HEAD/skills/tools/tig

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Tig

Tig 是一套基於 ncurses 的 Git 文字模式介面。它主要作為 Git 儲存庫瀏覽器使用。

使用時機

  • 終端機式 Git 歷史導航:在無頭伺服器環境中快速瀏覽提交圖譜、分支與標籤。
  • 互動式暫存與區塊提交:在不離開終端機的情況下審閱差異、暫存區塊以及還原未暫存的行。
  • Blame 與程式碼註解:逐行檢查提交作者、時間戳與提交記錄(tig blame)。
  • 低開銷 Git 審計:透過 SSH 連線審計大型企業 Git 儲存庫,無 GUI 延遲。

快速入門

1. 常用指令

# 開啟主要分支提交圖譜
tig

# 檢視特定檔案的歷史紀錄
tig path/to/file.ts

# 檢視未提交變更的差異(Status 檢視)
tig status

# 互動式 blame 檢視
tig blame path/to/file.ts

2. 基本導航按鍵

  • m:切換至 Main(提交圖譜)檢視
  • s:切換至 Status(暫存)檢視
  • d:檢視選取提交的差異
  • b:Blame 檢視
  • u:暫存 / 取消暫存選取的檔案或差異區塊
  • q:關閉當前檢視 / 離開

核心概念

生產環境 Tig 設定檔(~/.tigrc)

自訂顏色、按鍵綁定與檢視版面配置:

# ~/.tigrc
# 一般設定
set line-graphics = utf-8
set tab-size = 2
set main-view = id date:relative author:email-user commit-title:graph=yes,refs=yes
set diff-view = line-number:yes,interval=5
set status-view = line-number:yes

# 按鍵綁定:Vim 導航
bind generic j move-down
bind generic k move-up
bind generic g move-first-line
bind generic G move-last-line
bind generic <Ctrl-f> page-down
bind generic <Ctrl-b> page-up

# 快速操作
bind main <Enter> view-diff
bind status u stage-update
bind status s stage-update
bind status c !git commit -v

互動式暫存檢視與區塊暫存

在 Status 檢視中導航以審閱並暫存變更:

# 直接以狀態模式開啟 Tig
tig status

# Status 檢視中的按鍵操作:
# - 按 'u' 暫存/取消暫存檔案或區塊
# - 按 'Enter' 開啟選取檔案的差異檢視
# - 按 '1' 暫存單行
# - 按 'c' 開啟編輯器並建立提交

使用 tig blame 調查回歸問題

透過儲存庫歷史追溯程式碼行修改:

# 為特定檔案啟動互動式 blame 檢視器
tig blame src/auth/jwt_validator.go

# Blame 檢視中的導航:
# - 在任一行按下 'Enter' 以檢視引入該行的完整提交差異
# - 按 ',' 以 blame 該變更之前的父提交
# - 按 'q' 返回前一個檢視

常見工作模式

#自訂 Tig 按鍵綁定(~/.tigrc) 問題:需要快速的終端機暫存、rebase 與分支切換。
解決方案:在 ~/.tigrc 中定義自訂快速鍵。

# ~/.tigrc
# 將 'F' 綁定為從遠端提取
bind generic F !git fetch origin

# 在 Status 檢視中將 'C' 綁定為快速提交
bind status C !git commit -v

# 將 'P' 綁定為推送當前分支
bind generic P !git push origin HEAD

最佳實踐(2026)

  • 務必在 ~/.tigrc 中設定 main-view 為 commit-title:graph=yes,refs=yes,以顯示清晰的階層式分支結構。
  • 務必使用 tig blame 快速找出哪個 PR 或提交引入了有問題的程式碼行。
  • 務必利用 tig status 審閱並暫存個別行區塊(1),以達成精細、乾淨的 Git 提交。
  • 務必在 .tigrc 中將預設導航按鍵重新映射為 j/k(若習慣 Vim 按鍵綁定)。
  • 切勿在 Tig 中留下未解決的合併衝突;應使用 Tig 檢視衝突狀態,並在編輯器中解決。
  • 切勿在數 GB 的大型儲存庫中執行完整歷史的 Tig 檢視,而不指定分支或路徑限制。
  • 切勿忘記按 q 回上一層檢視,而非直接結束工作階段。

疑難排解

錯誤 / 症狀原因解決方案
終端機中顏色難以閱讀終端機主題對比與預設 Tig 調色盤衝突在 ~/.tigrc 中設定自訂顏色(例如 color diff-stat green default)。
Tig 開啟在錯誤的 Git 儲存庫根目錄當前工作目錄位於子模組內或儲存庫外部在執行 tig 前,先用 git rev-parse --show-toplevel 檢查。
blame 檢視出現 cannot open file: ...檔案已重新命名或在工作目錄中被刪除明確傳入提交參考:tig blame HEAD~2 -- path/to/file。

參考資料

Individual skills in this repo

This repo contains 11 individual skills — each has its own dedicated page.

G1Joshi/Agent-Skills

Expert Dask distributed computing assistance covering Dask DataFrames, Arrays, Futures, and cluster scaling. Use when analyzing datasets too large for pandas on a single machine or multi-node cluster.

G1Joshi/Agent-Skills

Expert dbt (data build tool) assistance covering SQL modeling, Jinja macros, tests, documentation, and semantic layer. Use when building analytics engineering pipelines on BigQuery, Snowflake, or PostgreSQL.

G1Joshi/Agent-Skills

Expert JAX assistance covering Autograd, XLA compilation (`jit`), vectorization (`vmap`), and parallelization (`pmap`). Use when building high-performance numerical computing and cutting-edge deep learning research.

G1Joshi/Agent-Skills

Expert Ray distributed computing assistance covering Ray Core (actors, tasks), Ray Train, Ray Tune, and Ray Serve. Use when scaling Python compute and ML training across multi-node clusters.

G1Joshi/Agent-Skills

Expert Git version control assistance covering branching, interactive rebase, cherry-pick, submodules, worktrees, and conflict resolution. Use when managing source code history and collaboration workflows.

G1Joshi/Agent-Skills

Expert K9s CLI assistance covering terminal Kubernetes cluster navigation, real-time log streaming, port forwarding, and pod debugging. Use when managing and troubleshooting Kubernetes clusters with speed.

G1Joshi/Agent-Skills

Expert SWC assistance covering high-performance Rust-based JavaScript/TypeScript compilation, .swcrc configuration, Jest testing via @swc/jest, and minification. Use when replacing Babel with SWC for faster builds, accelerating test execution, or compiling modern ECMAScript features.

G1Joshi/Agent-Skills

Expert Vim assistance covering modal editing, .vimrc configuration, registers, macros, search/replace, and plugin management via vim-plug. Use when editing text efficiently in terminal environments, writing Vimscript, recording macros, or configuring core Vim settings.

G1Joshi/Agent-Skills

Expert Zed editor assistance covering high-performance Rust-based text editing, multi-buffer editing, language server protocols (LSP), and AI assistant integrations. Use when configuring Zed settings.json, setting up language extensions, collaborating in real-time channels, or optimizing editor startup speed.

G1Joshi/Agent-Skills

Expert Zsh assistance covering shell customization, Oh My Zsh plugins, Zinit plugin manager, prompt engineering (Starship/Powerlevel10k), and shell scripting. Use when configuring .zshrc, writing Zsh automation scripts, optimizing shell startup time, or configuring tab-completion.

G1Joshi/Agent-Skills

Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].

相關技能