Can I delete all the local branches except the current one?

后端 未结 14 2440
广开言路
广开言路 2020-12-12 13:07

I want to delete all branches that get listed in the output of ...

$ git branch

... but keeping current branch, in one step. Is th

14条回答
  •  失恋的感觉
    2020-12-12 13:33

    first (switch to the branch you want to keep > ex: master):

    git checkout master
    

    second (make sure you are on master)

    git branch -D $(git branch)
    

提交回复
热议问题