How to create a Git alias for multiple commands and parameters
π
January 2, 2023
πGit
In this short article, we will show you how to create a Git alias for multiple commands and parameters. In the previous article, we explained you how to set a custom Git command.
Git Alias - Multiple Commands and Parameters
1. Set multiple commands
Use the following command to set alias for multiple commands.
[alias]
chs = !git branch && git status
So,
git chs -> git branch && git status
2. Pass parameters in Git alias
To set parameters in Git alias, use the following command.
[alias]
chs = !git checkout $1 && git status && :
If you add `&& :` to the end of your alias, then the spurious argument is consumed into a location tag.
git chs demo -> git checkout demo && git status
I hope you find this article helpful.
Thank you for reading. Happy Coding..!! π