简体   繁体   中英

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

feature/authorization-with-error

Remote repo branches:

feature/authorization-2

And I want to have only local branch which is on remote repo: feature/authorization-2

git branch --merged

you can skip some important branches

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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