How to delete all remote git branches which have already been integrated?

后端 未结 6 1961
暖寄归人
暖寄归人 2021-01-30 09:21

At work we are using topic branches which are integrated into a few (3) master branches at some point. Now I\'d like to delete all topic branches from my remote reposit

6条回答
  •  清歌不尽
    2021-01-30 09:48

    These are the commands I'm using to remove everything merge into origin/master. Basically, I remove all the branches merged into master from GitHub.

    git remote update -p &&
    git branch -r --merged origin/master |
    grep origin |
    grep -v master |
    cut -d"/" -f2- |
    xargs git push origin --delete
    

提交回复
热议问题