Aliases to Save Typing
An alias is a short name for a long command. It saves typing on the commands you run every day.
Make short names
Four aliases cover the commands this course runs most.
$ git config --global alias.st status
$ git config --global alias.co checkout
$ git config --global alias.br branch
$ git config --global alias.last "log --oneline -5"
$ git config --get-regexp aliasUse the short name
Two letters do the work of six.
$ git stA short log
The last alias prints the five newest snapshots.
$ git lastExample
$ git config --global alias.st status
$ git stKey points
- Alias lives in the settings, next to your name.
- Set it with config --global alias and the short name.
- The short name runs the full command.
- Keep aliases short and plain.
- An alias never changes what the command does.
- List them with config --get-regexp alias.
Here, st runs status. Two letters do the work of six.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
What does git st run here?