1

How to delete a whole bunch of stale remote merged git branches once. That's my problem. (Here I want to remove the remote branches in GitLab)

I expect the answer as a Git CLI command.

  • 1
    Does this answer your question? [How do I delete all Git branches which have been merged?](https://stackoverflow.com/questions/6127328/how-do-i-delete-all-git-branches-which-have-been-merged) – 1615903 Mar 03 '23 at 10:05
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 03 '23 at 16:27
  • Do you want to delete local branches merged into remote things, or do you want to delete remote branches which themselves are merged into something else? – Kim Mar 04 '23 at 19:02
  • @Kim I want to remove that remote branches as a bunch, I can do it with the delete button that GitLab provided, but It takes weeks. Therefore I want to do it as a whole bunch. – shalitha anuradha Mar 06 '23 at 07:42
  • @shalithaanuradha Then just follow the link provided by 1615903, it contains all the commands you need, you will however have to rewrite the command he wrote for deleting all local merged branches with the command he wrote for deleting a single remote branch – Kim Mar 06 '23 at 09:20
  • @Kim no it doesn't. I had to create another tool for this purpose, there is no way that Git CLI lists stale merged unprotected branches for a windows user. I follow the link given by 1615903. But none of that helps me to get over that. But I really appreciate your all help. Thank you. – shalitha anuradha Mar 09 '23 at 18:41
  • so `git branch -r --merged master | grep -v master | sed 's/origin\///' | xargs -n 1 git push --delete origin ` didn't work? fair enough... – Kim Mar 11 '23 at 07:43

0 Answers0