Background
For example, I have this alias in my `.zshrc``
1alias git-append="git commit --amend --no-edit -a"
But writing git-append
doesn't feel as nice as git append
, but we can fix that!
Adding a custom Git command
Thankfully we can define a Git alias in the Git configuration to use git append
instead of creating a shell alias. Here’s how you can do it:
-
Run the following command to create a Git alias for
append
:1git config --global alias.append "commit --amend --no-edit -a" -
Now, you can use the command
git append
directly.
This works because Git supports creating custom aliases within its configuration, and they are invoked with the git
command followed by the alias name.
And this works for any kind of command you want to create too!
Syntax highlighting by Torchlight.dev