Git:有没有办法删除(本地和远程)我创建的所有分支?
是否有脚本可以删除我创建的所有分支?
我在Stackoverflow和Internet上找到了有关列出作者列出分支机构的问题,例如
,但我找不到删除它们的内容。
有什么办法吗?
我还找到了一篇文章,用于未使用的分支批量删除,但没有作者
Is there a script to delete all the branches created by me?
I found questions on stackoverflow and on internet about listing the branches by author, like this
Is there a script to list git branches created by me?
But I could not find anything like delete them.
Is there any way?
I also found one this post for unused branch bulk delete but not by author
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
git不知道是谁创建了一些分支名称,所以不,这是不可能的。
名称也不存储父级信息。但是,您可以询问是否通过某些分支名称找到的提示commit 在中包含在中,通过一些其他分支名称找到的提交集,使用
git branch- -Merged
例如:将列出您的任何(本地)存储库分支名称,这些名称识别
Origin> Origin
'smain(如
)。git fet
上次更新,因此,git fetch
peith tirst tever威廉·普里尔(William Pursell)在评论中问:
您的答案是:
这里的区别在于关键,因为git并不是真正关于 branches ,而是关于 consits 。如果您要完全使用git,则必须必须了解提交。这也将使GIT的分支模型有意义。不过,我只会在这里重复所有内容,而是将您引用这个答案。
Git has no idea who created some branch name, so no, this is not possible in general.
Branch names do not store parent information either. You can, however, ask whether the tip commit found via some branch name is contained within the set of commits found via some other branch name, using
git branch --merged
for instance:will list out any of your (local) repository branch names that identify a commit that is contained within the commit-set found by
origin
'smain
(as last updated bygit fetch
, hence thegit fetch
step first).William Pursell asks, in a comment:
Your answer is:
The difference here is the key, because Git is not really about branches, but rather about commits. If you are going to use Git at all, you must learn about commits. This will also make Git's branching model make some sense. Rather than repeat it all here, though, I'll just refer you to this answer.