Posted almost 5 years ago. Visible to the public.

Remove multiple remote branches with git

If you want to delete a remote git branch then you can do so using the following command.

Copy
% git push origin :BRANCH-NAME

However if you cleanup a repository and have multiple remote branches you want to remove then you could do something like this:

Copy
% git branch -r | awk -F/ '/\/SOME-PREFIX/{print $2}' | xargs -I {} git push origin :{}

This will delete all remote branches starting with SOME-PREFIX.

Owner of this card:

Avatar
jan0sch
Last edit:
almost 5 years ago
by jan0sch
Posted by jan0sch to jan0sch's deck
This website uses cookies to improve usability and analyze traffic.
Accept or learn more