git-<command name>
Where "command name" in this case would be `archive-branch` and could be defined thusly: #!/bin/sh
# git-archive-branch
git_branch="${1:-$(git branch --show-current)}"
git co main &&
git tag archive/$git_branch $git_branch &&
git branch -D $git_branch
It then could be invoked the same as the alias: git archive-branch ...`git push —all backup` will record all of your refs and tags
If you are archiving branches in your own rep, prefix with `ar/` so you can grep -v to conceal them.
See also `git notes` to record metadata an against a commit without changing the commit
I dislike the official git completion script because it’s so slow when working with large repos. On macOS - because of vagaries of the way its file system works - with large repos it’s effectively unusable. Hint to completion script writers: if your “smart” completion ever takes seconds, it’s worse than useless and far worse than “dumb” filename completion.
How about just
# rename branch to archive/ prefix to indicate it is archived
git branch -m foo-branch archive/foo-branch