Recall & Review
beginner
What does the
-a option do in git commit -a?The
-a option automatically stages all modified and deleted files before committing, so you don't need to run git add first.Click to reveal answer
beginner
Can
git commit -a add new untracked files to the commit?No,
git commit -a only stages and commits modified or deleted files that are already tracked. New untracked files must be added with git add first.Click to reveal answer
beginner
How does
git commit -a simplify the commit process?It skips the manual staging step by automatically including all changes to tracked files, making commits faster and easier for quick edits.
Click to reveal answer
intermediate
What is the difference between
git add and git commit -a?git add stages changes manually, while git commit -a stages all tracked file changes automatically and commits them in one step.Click to reveal answer
beginner
Write the command to commit all modified tracked files with a message "Fix typo" without manually staging.
git commit -a -m "Fix typo"Click to reveal answer
What does
git commit -a do?✗ Incorrect
git commit -a stages all modified and deleted tracked files automatically before committing. It does not add new untracked files.
Which files are NOT included when using
git commit -a?✗ Incorrect
New untracked files must be added manually with git add. git commit -a only includes tracked files.
Which command is needed to include new files in a commit?
✗ Incorrect
New files must be staged with git add before committing.
What happens if you run
git commit -a -m "Update"?✗ Incorrect
This command stages all modified tracked files and commits them with the message "Update".
Why might you avoid using
git commit -a?✗ Incorrect
Using git commit -a skips manual staging, so you might miss reviewing changes carefully before committing.
Explain how
git commit -a changes the usual commit workflow.Think about what happens before the commit when using -a.
You got /4 concepts.
Describe a situation where using
git commit -a is helpful and one where it might cause problems.Consider speed versus control in committing.
You got /4 concepts.