Skip to content

Instantly share code, notes, and snippets.

@hoto
Last active March 14, 2017 21:48
Show Gist options
  • Save hoto/647c53623505cdac3e8fa47009a909c5 to your computer and use it in GitHub Desktop.
Save hoto/647c53623505cdac3e8fa47009a909c5 to your computer and use it in GitHub Desktop.
# GIT CLONE MIRROR FIRST FOR BACKUP
git clone --mirror git@...
# REMOVE ALL BRANCHES FROM REMOTE BUT LEAVE THOSE WHICH MRs ARE STILL OPEN
git branch --all | \
/bin/grep -v -E "develop|release|master|production|mcc-123-somebranch" | \
cut -d"/" -f3 | \
xargs -n1 git push origin --delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment