2022-08-11 最近使ったgit branch / git fetch --prune
最近使ったgit branch
--sort=-committerdate
を使うと良い。
$ git branch --sort=-committerdate
これをベースに gitconfig
とかで branch のスイッチを peco と組み合わせて簡単にできる alias を登録しておくと便利。
# .gitconfig
swb = !git branch --sort=-committerdate | tr -d '* ' | peco | xargs git switch
参考
- version control - How can I get a list of Git branches, ordered by most recent commit? - Stack Overflow
- git checkoutするブランチ名をpecoで選択する git エイリアス - Qiita
git fetch –prune
git fetch
に prune
オプションを付けると、リモートで削除されているブランチを自動で削除してくれる。
$ git fetch --prune