Open5

便利なGitコマンド集

Y.Y.

リモートで消されたブランチを自動的に削除 --prune

git fetch --prune
短縮形
git fetch -p
Y.Y.

コミットメッセージを変更 --amend

git commit --amend -m "message"
Y.Y.

リモートの変更を取り込む際のstashstash pop を自動化する --autostash

git pull --autostash

rebase する時も同様

git rebase --autostash

--autostashをデフォルトにしたい時

.gitconfig
# pull
git config --global pull.autostash true

# rebase
git config --global rebase.autoStash true

--autostashをデフォルトにしたけど、--autostashしたくない時

.gitignore
# pull
git pull --no-autostash

# rebase
git rebase --no-autostash
Y.Y.

プルリクエストを一瞬で手元に持ってくる(GitHub CLI

PR一覧を見る

gh pr list

該当のPRをローカルに持ってくる

gh pr checkout <Request番号>
短縮系
gh co <Request番号>
Y.Y.

リモートリポジトリを開く(GitHub CLI

該当プロジェクトのリモートGitHubリポジトリがブラウザで開く

gh browse