Git command aliasing
shortcuts and combinations for common Git commands
// updated 2025-04-24 16:44
Git command aliasing allows us to improve upon our git workflow with Git commands!
Shortening Git commands
On the command line, instead of typing out the high-frequency git status
entirely, we could configure it so that we only need to type git s
(or git st
or whatever we want):
1$ git config --global alias.s status
2$ git s
The Git manual recommends other aliases for high-frequency commands:
1$ git config --global alias.co checkout
2$ git config --global alias.br branch
3$ git config --global alias.ci commit
Combining Git commands
We could also combine git add and git commit into one command:
1$ git config --global alias.add-commit '!git add -A && git commit'
2$ git add-commit -m 'my commit message'
Combining the above two, we can do something like:
1$ git config --global alias.ac add-commit
2$ git ac -m "my commit message"
In general:
1$ git config --global alias.{alias} {command}
2$ git {alias} [flags]
Other examples
Short for git push origin master
(pushing to the cloud):
1$ git config --global alias.pom 'push origin master'
2$ git pom
Short for git checkout -b {branch-name}
(checking into a new branch):
1$ git config --global alias.cob 'checkout -b'
2$ git cob {new-branch-name}
Enjoy!