Skip to content

Instantly share code, notes, and snippets.

@yanaokahiroki
Last active August 8, 2022 11:58
Show Gist options
  • Save yanaokahiroki/aa867843c56c5ac82ea21e5eb7e6e089 to your computer and use it in GitHub Desktop.
Save yanaokahiroki/aa867843c56c5ac82ea21e5eb7e6e089 to your computer and use it in GitHub Desktop.

概要

ローカルのfeature ブランチを一括で削除したかった。

git branch -D feature/1 feature/2 ... でやっていたがブランチの指定が面倒だったのでメモ。

コマンド

git branch --list "feature/*" | xargs -n 1 git branch -D

まずbranchコマンドで feature ブランチをすべて取得します。

その後 xargs コマンドでそれを取得し削除コマンドに渡します。

これで feature/*に合致するブランチをすべて削除できます。

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment