Open6

tigをまとめる

ispernispern

なんとなくtigを使っていたけど、マニュアルと設定見直して学び直し

tig上でやりたいこと

  • GithubのPRレビュー
  • GithubのPR作成
  • 今いるブランチの作業中ソースをstashに入れて、別ブランチ切り替え
ispernispern

gh-cliを絡めたtigの設定

カレントのブランチでPR作る

bind status gpr ?gh pr create --fill --web --assignee "@me"
ispernispern

ブランチビューのキーバインド

ブランチビューなので bを開始キーにした

bind branch b none
bind branch bd !?git branch -d %(branch)
bind branch bD !?git branch -D %(branch)
bind branch ba !?git delete-merged-branch %(branch)
bind branch bC !git checkout -b %(prompt) %(branch)

delete-merged-branchコマンドは、 独自エイリアスで、マージ済みのローカルブランチを一括で削除するエイリアス。

~/.gitconfigのaliasに以下を追加

[alias]
delete-merged-branch = "!f () { git checkout $1; git branch --merged | egrep -v '\\*|develop|main|master' | xargs git branch -d; };f"