简体   繁体   English

如何删除所有合并到某些分支的远程分支

[英]How to delete all remote branches merged into certain branches

if I have many remote branches merge into branch DEV , how do I list all remote branches merged into DEV and how to delete these remote branches. 如果我有许多远程分支合并到分支DEV ,如何列出所有合并到DEV远程分支以及如何删除这些远程分支。

git branch -r --merged <commit>

this command shows all remote branches are reachable from the specified commit. 此命令显示从指定提交可访问所有远程分支。

but i don't know how to delete it. 但我不知道如何删除它。 Please guide. 请指导。

you can use git branch -d branchname if the branch is merged. 如果分支合并,则可以使用git branch -d branchname

if the branch is not merged, you can use git branch -D branchname to delete the specific branch. 如果分支未合并,则可以使用git branch -D branchname删除特定分支。

删除所有合并的远程分支

git branch -r --merged | grep -v master | sed 's/origin\//:/' | xargs -n 1 git push origin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM