By Joel Dare ⟡ Updated December 4, 2025 Written March 17, 2025
Git has a built-in alias system that allows you to create custom commands, similar to npm run scripts or a simple alternative to a Makefile.
A Git alias can:
Let’s say we frequently update a GitHub Pages site stored in a /www directory. Normally, we would run:
git push origin main
git subtree push --prefix www origin gh-pages
Instead, we can create a custom Git alias:
git config alias.deploy '!git push origin main && git subtree push --prefix www origin gh-pages'
Now, we can deploy everything with a single command:
git deploy
! allow running shell commands..git/config file (or globally with --global).git config --get alias.deploy
Git aliases are a simple way to automate repetitive tasks. Whether you use them for deployments, logs, or rebases, they can speed up your workflow and keep commands consistent.
JoelDare.com © Dare Companies Dotcom LLC
through formrobin.com