Archive for the ‘ GIT ’ Category

Author : beriba | 09/02/2013

Have you ever had too many GIT branches? Have you ever looked for a way to remove half of them or even all? If „Yes” is an answer for any of those two questions, this tip is for you. Probably you’ll have about 3 questions about removing git branches:
1. Is that possible? Yes
2. Is it built-in? No
3. How to do that? Look below

git branch -D `git for-each-ref --format="%(refname:short)" refs/heads/bugs_\*`

A little bit of explaination. Above command will remove permanently (without asking!) any branch that starts with „bugs_” (without quotes of course). You have to put backslash before * (asterisk), ? (question mark) and probably before few more characters. If you don’t know what is „git for-each-ref” feel free to ask me in a comment.