0
0
Gitdevops~5 mins

Creating aliases for common commands in Git - Quick Revision & Summary

Choose your learning style9 modes available
Recall & Review
beginner
What is a Git alias?
A Git alias is a shortcut name for a longer Git command or series of commands. It helps you run common commands faster by typing a short word instead of the full command.
Click to reveal answer
beginner
How do you create a Git alias for the command git status?
You run git config --global alias.st status. Now, typing git st will show the status.
Click to reveal answer
intermediate
Where are Git aliases stored when created with --global?
They are stored in the global Git configuration file, usually located at ~/.gitconfig.
Click to reveal answer
intermediate
How can you list all Git aliases you have set?
Run git config --get-regexp alias to see all aliases and their commands.
Click to reveal answer
advanced
Can Git aliases include multiple commands or shell commands?
Yes, by prefixing the alias command with an exclamation mark !, you can run shell commands or multiple commands in one alias.
Click to reveal answer
Which command creates a Git alias named co for checkout?
Agit config alias.co checkout
Bgit alias co checkout
Cgit config --global alias.co checkout
Dgit alias --global co checkout
After creating an alias st for status, how do you use it?
Agit st
Bgit status st
Cgit alias st
Dgit use st
Where does Git store aliases created without the --global flag?
AIn the system-wide Git config file
BIn the user's home directory
CIn the Git installation folder
DIn the current repository's local Git config file
How do you create a Git alias that runs a shell command?
Agit alias ls !ls -la
Bgit config alias.ls '!ls -la'
Cgit config alias.ls ls -la
Dgit alias ls ls -la
What command lists all Git aliases you have set?
Agit config --get-regexp alias
Bgit config --list
Cgit alias list
Dgit alias --show
Explain how to create and use a Git alias for a common command like git status.
Think about how to shorten commands you use often.
You got /3 concepts.
    Describe how Git aliases can run shell commands and why that might be useful.
    Consider how to extend Git commands beyond built-in ones.
    You got /3 concepts.