Custom Git Subcommands

#git

Git allows you to create custom subcommands by simply adding executables with the git- prefix to your PATH. This means any executable named git-foo automatically becomes available as git foo.

I discovered this while porting the multi-git-status project from Bash to Python. My new implementation, git-multi-status, leverages this Git feature to integrate with the native Git command-line experience.

To create your own custom Git command:

  1. Create an executable script or program with a name that starts with git-
  2. Ensure it is executable (chmod +x git-my-command)
  3. Place it somewhere in your PATH
  4. Use it like any built-in Git command: git my-command

You can see this yourself with uv tool install git-multi-status && git multi-status.

Top