AI Hints
Home›Git & GitHub Tutorial›Aliases and Searching
Git & GitHub · Lesson 95 of 144

Shortcuts with Aliases

Git config alias.

⏱ 2 min read▶ Video at 1:44:06🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Some commands you'll type hundreds of times a day. Git lets you create your own short names for them. They're called aliases, and they live in your Git config.

Shortcuts with Aliases
From the video: Shortcuts with Aliases
  • Commands you type all day
  • Make your own short names
  • They're called aliases

Creating aliases

Git config dash dash global, alias dot s t, and the word status. Now git s t means git status. Let's add a few more. CO for commit. And one called graph, for that long log command we love. Now git graph draws the whole history, with just two words.

git
git config --global alias.st status
git st
On branch main
nothing to commit, working tree clean
git config --global alias.co commit
git config --global alias.graph 'log --oneline --graph --all'
git graph
* f63a17a (HEAD -> main) Link to about page
* ef9c947 Add basic styles
* 6784119 Add about page
* 0ba6049 Add welcome text
* f7d9757 Add home page

Here are some aliases many developers use. ST for status. BR for branch. Graph, for the long log command. And last, for log dash one, head, to see the latest commit. Keep yours short, and only make aliases for commands you really use a lot.

keyvalue
git ststatus
git brbranch
git graphlog --oneline --graph --all
git lastlog -1 HEAD

Summary

Git config dash dash global alias dot name creates a shortcut. Keep a few for your most used commands. Next, searching through history.

Key takeaways
  • git config --global alias.st status
  • git st
  • git graph
Next up: Searching History — find any commit