Q:

for loop over all git branches with certain name

I have the following git branches
foo
bar
foobar
feature/foo
feature/bar
feature/buzz

How would you do a for loop over all branches that start with the word 'feature/' ? 
When I try the following, it strangely prints out more than just the git branches. 
for i in $(git branch --list "feature/*"); do echo $i; done;
stuff.txt
icon.jpg
morestuff.txt
Vagrantfile
feature/foo
feature/bar
feature/buzz

A:

"We actively discourage against use of any Porcelain command, including git branch, in scripts" - from the Git Maintainer's Blog
You want to use something like 
git for-each-ref --format='%(refname:short)' refs/heads/feature/
which will work fine inside a for br in $() construct

