Challenge - 5 Problems
Git Commit Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this git commit command?
You run the command
git commit -m "Initial commit" after staging some files. What will git display?Git
git commit -m "Initial commit"
Attempts:
2 left
💡 Hint
Think about what happens when you commit after staging files.
✗ Incorrect
When you run
git commit -m "message" after staging files, git creates a new commit with that message and shows a summary of changes.💻 Command Output
intermediate2:00remaining
What error does this git commit command produce?
You run
git commit -m without providing a message. What error message will git show?Git
git commit -mAttempts:
2 left
💡 Hint
The -m option expects a message string immediately after it.
✗ Incorrect
Git requires a message after -m. Without it, git shows: error: switch `m' requires a value.
🔀 Workflow
advanced2:00remaining
Which command sequence correctly commits changes with a message?
You have modified files and want to commit them with the message "Update README". Which sequence is correct?
Attempts:
2 left
💡 Hint
Remember you must stage files before committing.
✗ Incorrect
You must add files first with
git add, then commit with git commit -m. Option A follows this order.❓ Troubleshoot
advanced2:00remaining
Why does this git commit command fail?
You run
git commit -m "Fix bug" but get the message: fatal: no changes added to commit. Why?Git
git commit -m "Fix bug"
Attempts:
2 left
💡 Hint
Check if you used
git add before committing.✗ Incorrect
Git requires files to be staged before committing. Without staging, it shows: fatal: no changes added to commit.
✅ Best Practice
expert3:00remaining
Which git commit command correctly includes a multi-line message?
You want to commit with a title and a detailed description. Which command correctly does this?
Attempts:
2 left
💡 Hint
Git allows multiple -m options for multi-line messages.
✗ Incorrect
Using multiple -m options adds multiple paragraphs to the commit message. Option D is correct.