Remix.run Logo
AdieuToLogic 7 hours 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 ...
vbezhenar 2 hours ago | parent | next [-]

Why is this useful? Why would someone care about typing `git archive-branch` instead of `git-archive-branch`?

kreetx an hour ago | parent [-]

Consistency: not needing to remember under which alternative methods any command was found under.

rurban 2 hours ago | parent | prev [-]

Oh oh. Your co alias leaked :)