For git, I have many branches that I start off with temp
, so to filter all the temporary branches, I tried:
git branch | grep "^temp"
However, I am not getting any result.
If I just run git branch
, I get the following:
temp/github-fix
temp/mismatches
test/temp
I want to just match the first two, but not the last one.
You can use --list
followed by a pattern to list the branches you want.
git branch --list 'temp*'