- Published on
Simplify Your Git Commands with Git Alias
- Authors
- Name
- Ashik Nesin
- @AshikNesin
Ever wanted to improve the git workflow that you use every day?
Run a single command instead of running very long multiple commands.
For such cases, having a git alias
could be a better choice.
What is Git Alias?
Just like the name suggests, we can set an alias for any command in git.
And so instead of running a long and complicated command. You can run short command instead.
In our case, we'll have a git save
alias that will take care of committing the current change with a default commit message.
How to set a new Git alias?
We need to use the git config command with the alias.<new_alias_name>
option.
Like:
git config --global alias.save "!git add -A && git commit -m 'chore: commit save point'"
After running that command it'll be configured in your global git config (~/.gitconfig)
From now on we can just run git save
to save our changes instead of running multiple commands.
Happy better workflows!