2

I used to delete multiple branches in my local, but how can I delete the same branches in romote?

git branch | grep "<pattern>" | xargs git branch -D
Hubery
  • 31
  • 1
  • 4
    Possible duplicate of [How do I delete a Git branch both locally and remotely?](https://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-both-locally-and-remotely) – Maria Ines Parnisari May 27 '17 at 03:36
  • 1
    This sounds like a very HIGH RISK thing to ask. I'd suggest that if you're not really sure how to do it once, don't muck around with doing it lots of times. Just do them one at a time using the method in the question Maria Ines Panisari linked to. – GregHNZ May 27 '17 at 04:57
  • Possible duplicate of [Can you delete multiple branches in one command with Git?](https://stackoverflow.com/questions/3670355/can-you-delete-multiple-branches-in-one-command-with-git) – Milan Chheda May 27 '17 at 05:23

1 Answers1

1

Answer from How do I delete a Git branch locally and remotely?

To delete remote branchs since Git 1.7.0 version, you can do:
git push <remote_name> --delete <remote_branch_name>
For example if there is in origin a branch called experiment the command will be:
git push origin --delete experiment

Note: Use this command with caution, so you have to perform each deletion at a time.

Jonas Freire
  • 165
  • 3
  • 4