这条代码如何删除GitHub中的所有分支?

发布于 2025-02-13 20:15:51 字数 283 浏览 0 评论 0原文

我将为我们自动化分支机构自动化的静态存储库做一个清理任务。 我知道此命令删除了除产品以外的每个分支,但我无法弄清楚命令的含义。什么是剪切命令,$ 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对不⑦ 2025-02-20 20:15:51

在每个命令的终端运行中,并标记此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 -c
man cut | sed -n "/^\s*-c/,/^$/p"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文