読者です 読者をやめる 読者になる 読者になる

ログってなんぼ

日々のメモです

複数のブランチをまとめて削除する

例えばこんな状況

$ git branch
* develop
  issue_105
  issue_105_2
  issue_138
  issue_16
  issue_17
  issue_177
  issue_18
  issue_20
  issue_209
  issue_20a
  issue_21
  issue_211
  issue_214
  issue_216
  issue_228
  issue_252

issue_*ブランチをパイプでgrep

$ git branch | grep 'issue_'
  issue_105
  issue_105_2
  issue_138
  issue_16
  issue_17
  issue_177
  issue_18
  issue_20
  issue_209
  issue_20a
  issue_21
  issue_211
  issue_214
  issue_216
  issue_228
  issue_252

更にパイプで処理

$ git branch | grep 'issue_' | xargs git branch -d