๐ŸŽ“ A1Learner
๐Ÿ”
0 of 50 lessons completed

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 alias

Use the short name

Two letters do the work of six.

$ git st

A short log

The last alias prints the five newest snapshots.

$ git last

Example

$ git config --global alias.st status
$ git st

Key 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?