Challenge - 5 Problems
Git Alias Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of a Git alias command
What is the output of running
git co after setting the alias co to checkout?Git
git config --global alias.co checkout git co -b new-branch
Attempts:
2 left
💡 Hint
Think about what 'checkout -b' does in Git.
✗ Incorrect
The alias 'co' replaces 'checkout'. The command 'git co -b new-branch' creates and switches to a new branch named 'new-branch'.
❓ Configuration
intermediate1:30remaining
Correct syntax for setting a Git alias
Which command correctly sets a Git alias named
st for status?Attempts:
2 left
💡 Hint
Git aliases are set using the config command with 'alias.' prefix.
✗ Incorrect
The correct syntax uses 'git config --global alias.st status' to set the alias globally.
❓ Troubleshoot
advanced2:00remaining
Troubleshooting a Git alias that does not work
You set a Git alias
lg as log --oneline --graph but running git lg gives an error. What is the most likely cause?Git
git config --global alias.lg 'log --oneline --graph'
Attempts:
2 left
💡 Hint
Check how Git stores alias commands in the config file.
✗ Incorrect
Git aliases should be set without quotes around the command. Quotes become part of the alias and cause errors.
🔀 Workflow
advanced2:30remaining
Using Git aliases in a workflow
You have these aliases set:
Which sequence of commands uses these aliases to create and switch to a new branch named
git config --global alias.co checkoutgit config --global alias.br branchWhich sequence of commands uses these aliases to create and switch to a new branch named
feature and then list all branches?Attempts:
2 left
💡 Hint
Remember what 'checkout -b' and 'branch' commands do.
✗ Incorrect
'git co -b feature' creates and switches to 'feature'. 'git br' lists branches. This uses the aliases correctly.
✅ Best Practice
expert2:00remaining
Best practice for naming Git aliases
Which of the following is the best practice when naming Git aliases for common commands?
Attempts:
2 left
💡 Hint
Think about ease of use and avoiding errors.
✗ Incorrect
Short, memorable aliases that do not conflict with Git commands help avoid confusion and improve efficiency.