9

Possible Duplicate:
Can you delete multiple branches in one command with Git?

I'm trying to clear out my old feature branches in my git repo, and I find myself typing

git branch -d SOME_BRANCH_NAME 

for each branch name. Does git support any type of wildcard expansion, so I could specify something like:

git branch -d temp_branch_* 

thanks

Community
  • 1
  • 1
worker1138
  • 2,071
  • 5
  • 29
  • 36

1 Answers1

24

Well, in the worst case, you could:

git branch | grep temp_branch | xargs git branch -d
Carl Norum
  • 219,201
  • 40
  • 422
  • 469
  • 1
    I think this is a better answer than any of the ones on the question this is a duplicate of. – keithepley May 22 '13 at 20:55
  • 2
    Just want to add that "git branch" decorates the output a bit, so this is not exactly the Right Way to do it -- it adds a `*` to the current branch in particular. I think something like `git for-each-ref --format "%(refname)" 'refs/heads/topic/*'` is better. – Colin D Bennett Oct 23 '13 at 17:03