Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
現在のブランチにすべてのコミットが含まれているブランチを削除するgitコマンドを作成したいと思います。
$ git branch groups * master $ git cleanup-branches deleted groups # all commits are included in master $ git branch * master
これを作成するにはどうすればよいですか?
git branch -d現在のブランチにまだマージされていないブランチは削除されないため、ここで活用できます。
git branch -d
git config --global alias.cleanup-branches \ '!git branch | grep -v "\*" | awk "{ print $1 }" | xargs git branch -d'
これをローカルで試してみて、うまくいきましたが、動作するのを見るのは少し恐ろしいです。