Last active
November 20, 2018 23:17
-
-
Save nsmith-/6d9d29ed66cf71e0e92e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete all tags | |
git ls-remote -t my-cmssw | sed 's:^.*refs/tags/::' | while read t; do git push my-cmssw :$t; done | |
# Delete all branches | |
git ls-remote -h my-cmssw |sed 's:^.*refs/heads/::' | while read b; do git push my-cmssw :$b; done | |
# Or, save list of branches, and remove ones you want to keep | |
git ls-remote -h my-cmssw |sed 's:^.*refs/heads/::' > branches_to_del | |
vim branches_to_del | |
while read b; do git push my-cmssw :$b; done < branches_to_del |
Here is a similar command, but avoids an issue that occurred in practice when the list of tags was too long for GitHub to accept it all at once:
git ls-remote --tags my-cmssw | cut -f2 | sed 's~refs/tags/~~' | xargs -n 1000 -P 1 git push my-cmssw --delete
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I haven't tested it, but I think
should be faster for people with many tags