这条代码如何删除GitHub中的所有分支?
我将为我们自动化分支机构自动化的静态存储库做一个清理任务。 我知道此命令删除了除产品以外的每个分支,但我无法弄清楚命令的含义。什么是剪切命令,$ b是用什么?谁能为我分解这一点吗?
for b in `git branch --all | cut -c18- | grep -v prod`; do echo $b;
done for b in `git branch --all | cut -c18- | grep -v prod`; do git push origin :$b $b; done
I am going to do a clean up task for our static repository where we automate branches to.
I know this command deleted every branch besides prod but I haven't been able to figure out what the commands mean. What is the cut command and what is the $b for? Can anyone help break this down for me?
for b in `git branch --all | cut -c18- | grep -v prod`; do echo $b;
done for b in `git branch --all | cut -c18- | grep -v prod`; do git push origin :$b $b; done
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在每个命令的终端运行中,并标记此
man命令| sed -n“/^\ s*flag/,/^$/p”
在剪切-c的情况下人切割| sed -n“/^\ s*-c/,/^$/p”
In the terminal run for each command and flag this
man command | sed -n "/^\s*flag/,/^$/p"
in case of cut -cman cut | sed -n "/^\s*-c/,/^$/p"