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.
正如@ WumpusQ.Wumbley指出的那样, git branch
输出通常以空格开头,请尝试使用git branch|grep '^\\s*temp'
您可以使用--list
后跟一个模式来列出所需的分支。
git branch --list 'temp*'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.