git delete remotes: remote refs do not exist

前端 未结 3 589
感情败类
感情败类 2021-01-29 23:41

In short;

  • How can I delete remote multiple merged remotes?

More background;

I have a git repo with tens of remotes which have been merge

相关标签:
3条回答
  • 2021-01-30 00:18

    You may need to prune your local "cache" of remote branches first. Try running:

    git fetch -p origin

    before deleting.

    0 讨论(0)
  • 2021-01-30 00:19

    Are those branches removed from the remote (origin)? If yes, you can simply do

    git fetch --prune origin
    

    Otherwise they might return even after you delete them locally.

    Update: Looking at your command again, it looks like you're building it incorrectly. You probably want

    git push origin --delete myBranch-1234
    

    but instead you are doing something like

    git push origin --delete origin/myBranch-1234
    
    0 讨论(0)
  • 2021-01-30 00:41

    Use sed to remove 'origin/' part and change a lttile xargs part.

    git branch -r --merged | grep origin | grep -v -e master | sed s/origin\\/// |  xargs -I{} git push origin --delete {}
    
    0 讨论(0)
提交回复
热议问题