Head to the top of the git repository.
$ cd path/to/repo/top
Check out the branch you want, pull, update, whatever to put it into the state you want to archive.
$ git co branch-to-archive $ git up $ git pull $ git whatever
Run this to archive the branch
$ git archive branch-to-archive | gzip > ../some/archive/path/repo-name-branch-name.YYMMDD.tar.gz
Check the repo is what you want:
$ tar tvfz ../some/archive/path/repo-name-branch-name.YYMMDD.tar.gz | less
Delete the branch remotely and locally:
$ git push origin :branch-to-archive $ git branch -D branch-to-archive
And, of course, I have this in a script.