1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

gitの複数のブランチを一括で削除する

1
Posted at

複数ブランチを一括削除する Tips はあったが、
grep の引数に複数の値を渡すのどうやるんだっけとなり調べたのでメモ。
-e オプションで書いてやるといいらしい

git branch | grep \
-e hoge_branch \
-e fuga_branch \
| xargs git branch -d ;

以下、grep のドキュメントから抜粋

   Matching Control
       -e PATTERNS, --regexp=PATTERNS
              Use PATTERNS as the patterns.  If this option is used
              multiple times or is combined with the -f (--file) option,
              search for all patterns given.  This option can be used to
              protect a pattern beginning with “-”.

参考にした記事:

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?