What gets bag-n-tagged
I just run a script that looks for branches that are more than 90 days old:
git for-each-ref --format='%(refname)' refs/remotes/origin | { exp=$(( $(date +'%s') - 7776000 )); while read ref; do if test ${exp} -gt $(git show -s --pretty=format:'%ct' $ref); then echo $ref fi done; }
I then email htcondor-devel to politely ask if I can bag-n-tag the branches listed.
When a branch gets bag-n-tagged
I create a tag with the name of the branch, ending in "-tag". So branch "foo" will get tagged with tag "foo-tag". I run the following git commands
git tag -a -m "Bag-n-tag branch foo" foo-tag foo # To create the foo-tag tag git push origin tag foo-tag # To publish the new tag git push origin :refs/heads/foo # To delete the branch
How to resurrect a branch
If a branch is overzealously deleted, it is easy to restore. You may still have the old reference around, so you could run
git push origin refs/remotes/origin/foo:refs/heads/foo
If you have only the tag, you can do the following
git branch foo foo-tag^{} git push origin foo:foo