简体   繁体   English

如何清除(删除)所有合并的本地分支?

[英]How to clear (delete) all merged local branches?

Sometimes I have a few versions of the same features on other branches which has very similar names.有时我在名称非常相似的其他分支上有几个相同功能的版本。 How can I remove all local branches which are not on remote repo?如何删除不在远程仓库中的所有本地分支?

A little example: My local branches:一个小例子:我当地的分支机构:

feature/authorization功能/授权

feature/authorization-2功能/授权-2

feature/authorization-with-error功能/授权错误

Remote repo branches:远程仓库分支:

feature/authorization-2功能/授权-2

And I want to have only local branch which is on remote repo: feature/authorization-2而且我只想拥有远程仓库上的本地分支:feature/authorization-2

git branch --merged

you can skip some important branches你可以跳过一些重要的分支

git branch --merged| egrep -v "(^\*|master|main|dev|skip_branch_name)"

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

相关问题 Git:如何删除所有本地分支(合并与否),除了master和develop - Git : How to delete all local branches (merged or not), except master and develop 如何使用 PowerShell 删除 Git 中所有合并的本地分支 - How to delete all merged local branches in Git with PowerShell 删除所有被压扁并合并的本地分支 - Delete all local branches that have been squashed and merged 如何删除所有合并到某些分支的远程分支 - How to delete all remote branches merged into certain branches 如何删除所有本地分支,如果合并为主分支将导致无变化? - How can I delete all local branches which would result in no changes if merged into master? 如何将所有合并的远程 git 分支转换为标签? (创建标签,删除分支) - How to convert all merged remote git branches to tags? (create tags, delete branches) 删除所有本地 git 分支 - Delete all local git branches 如何删除所有已合并的 Git 分支? - How do I delete all Git branches which have been merged? 如何删除在 git 中以编程方式合并到 master 的超过 1 个月的分支? - How to delete branches older than 1 month that was merged to master programmatically in git? 仅本地更改-如何删除没有相应本地分支的所有远程跟踪分支? - Local changes only - How do I delete all remote tracking branches without a corresponding local branch?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM