0
0
Gitdevops~15 mins

Creating aliases for common commands in Git - Try It Yourself

Choose your learning style9 modes available
Creating aliases for common commands
📖 Scenario: You often use Git commands to manage your code projects. Typing long commands repeatedly can be tiring. To save time, you want to create shortcuts called aliases for your most common Git commands.
🎯 Goal: Learn how to create Git aliases to run common commands faster by typing short words instead of full commands.
📋 What You'll Learn
Create a Git alias for the git status command
Create a Git alias for the git log --oneline command
Create a Git alias for the git checkout command
Display the list of all Git aliases to verify your setup
💡 Why This Matters
🌍 Real World
Developers use Git aliases daily to speed up their workflow and avoid typing long commands repeatedly.
💼 Career
Knowing how to create and manage Git aliases is a useful skill for software developers, DevOps engineers, and anyone working with version control.
Progress0 / 4 steps
1
Create an alias for git status
Use the command git config --global alias.st status to create a Git alias called st that runs git status.
Git
Need a hint?

This command sets a shortcut st for git status globally on your computer.

2
Create an alias for git log --oneline
Use the command git config --global alias.lg "log --oneline" to create a Git alias called lg that runs git log --oneline.
Git
Need a hint?

Use quotes around log --oneline because it has a space.

3
Create an alias for git checkout
Use the command git config --global alias.co checkout to create a Git alias called co that runs git checkout.
Git
Need a hint?

This alias lets you type git co instead of git checkout.

4
Display all Git aliases
Run the command git config --global --get-regexp alias to show all your Git aliases and verify they are set correctly.
Git
Need a hint?

This command lists all aliases starting with alias..