【问题标题】:Git command with wildcard expansion [duplicate]带有通配符扩展的 Git 命令 [重复]
【发布时间】:2011-09-21 17:59:07
【问题描述】:

可能重复:
Can you delete multiple branches in one command with Git?

我正在尝试清除 git 存储库中的旧功能分支,但我发现自己正在输入

git branch -d SOME_BRANCH_NAME 

对于每个分支名称。 git 是否支持任何类型的通配符扩展,所以我可以指定如下内容:

git branch -d temp_branch_* 

谢谢

【问题讨论】:

    标签: git wildcard


    【解决方案1】:

    好吧,在最坏的情况下,你可以:

    git branch | grep temp_branch | xargs git branch -d
    

    【讨论】:

    • 我认为这是一个更好的答案,比这个问题的任何一个都好。
    • 只想添加“git 分支”来稍微修饰输出,所以这不是正确的方法——它特别是在当前分支中添加了一个*。我认为像git for-each-ref --format "%(refname)" 'refs/heads/topic/*' 这样的东西更好。
    猜你喜欢
    • 2022-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-29
    • 2013-09-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多