Recall & Review
beginner
What does the command
git diff show by default?It shows the changes in the working directory that are not yet staged for commit.
Click to reveal answer
beginner
How can you see the changes that are staged for the next commit?
Use
git diff --cached or git diff --staged to see staged changes.Click to reveal answer
intermediate
What is the difference between
git diff and git diff HEAD?git diff shows unstaged changes, while git diff HEAD shows all changes (staged and unstaged) compared to the last commit.Click to reveal answer
beginner
How do you limit
git diff output to a specific file?Add the file name at the end, like
git diff filename.txt.Click to reveal answer
beginner
What does the output of
git diff look like?It shows lines removed with a minus (-) and lines added with a plus (+), highlighting the exact changes.
Click to reveal answer
What does
git diff show by default?✗ Incorrect
git diff by default shows changes in your working directory that you have not yet staged.
Which command shows changes staged for the next commit?
✗ Incorrect
git diff --cached shows the staged changes ready to be committed.
How do you see all changes (staged and unstaged) compared to the last commit?
✗ Incorrect
git diff HEAD compares your current working directory and staging area to the last commit.
What symbol in
git diff output indicates a line was removed?✗ Incorrect
Lines removed are shown with a minus (-) sign in git diff output.
How to limit
git diff output to a single file?✗ Incorrect
Simply add the file name after git diff to see changes for that file only.
Explain what
git diff shows and how it helps in tracking changes.Think about what you see before you save your work.
You got /4 concepts.
Describe the difference between
git diff and git diff --cached.One shows changes not ready to commit, the other shows changes ready to commit.
You got /4 concepts.