AdieuToLogic
a month ago
On a related note, git supports incorporating custom commands via executables available in the `PATH` having the naming convention of:
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 ...