Bivor Faruque
Posted on August 9, 2022
As we are developers we love to automate stuff. However, I feel that our use of git is quite a manual process and takes our time. In this article, I am going to discuss how I use alias to help me. Hope this is useful to you.
Alias for add, commit and push
So we all remember the tedious commands for pushing our code to a remote git branch whenever we make any changes to our code we have to use,
git add . //To add all your changes
git commit -m "my commit" //commit the changes that are made with a message
git push //push the commit to your repo
It seems like small but it is a very tedious process once you do it over and over again. Thus, comes the following alias to do add, commit and push it all in one command
git config --global alias.cmp '!f() { git add -A && git commit -m "$@" && git push; }; f'
After running this command in your cmd. You can just do the following to add, commit and push your changes.
git cmp "my commit"
Alias for add and commit
However, sometimes we just need to do a local commit.
git add . //To add all your changes
git commit -m "my commit" //commit the changes that are made with a message
No worries, I am lazy too,
git config --global alias.ac "!git add -A && git commit -m "
After running this command in your cmd. You can just do the following to add and commit your changes.
git ac "my commit"
Thanks for reading, and happy coding!
Posted on August 9, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.