DEV Community

Cover image for Make Git command alias
Ruben Alvarado
Ruben Alvarado

Posted on Edited on

Make Git command alias

This entry is also available in my blog: Web Warrior Toolbox

I like using git commands but I don't like typing the same sequence of commands over and over. I found that instead of typing

git add .
git commit
Enter fullscreen mode Exit fullscreen mode

I can make an alias using

git config --global alias.ac '!git add . && git commit'
Enter fullscreen mode Exit fullscreen mode

Now, instead of typing both commands, I can simply run:

git ac -m "fix: update controller"
Enter fullscreen mode Exit fullscreen mode

This is equivalent to:

git add .
git commit -m "fix: update controller"
Enter fullscreen mode Exit fullscreen mode

If I run git ac without -m, Git will open the configured editor so I can write the commit message.

A small alias that can accelerate a repetitive sequence. Always be learning, dev-san πŸš€

Top comments (0)