Git shortcuts and tricks
Sometimes it's too tedious and boring to type-in something like '
git commit -a -m' 50 times per day. In this case the shell aliases can be the solution. All you need is to add the following lines to your shell configuration file (
.bash_profile if you use bash) and you will be able to type '
gs' instead of '
git status'. These are my aliases, but feel free to adapt them for yourself:
Another way to create git shortcuts is global git configuration. To accomplish this, we need to update the global git configuration, for example:
git config --global alias.s status
creates the '
git s' shortcut for the '
git status' command.
So, the next time you just need to enter the
git s command in the terminal to fire the
If you want to check out the list of aliases, you can find them in the
~/.gitconfig file (alias section). Also, if you want, you can edit this file manually. For example:
Add branch name to the terminal prompt
Add the following code to your ~/.bash_profile