0
0
Gitdevops~5 mins

git diff for working directory changes - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AAll files in the repository
BChanges already committed
CChanges staged for commit
DChanges in the working directory not staged for commit
Which command shows changes staged for the next commit?
Agit diff --cached
Bgit diff HEAD
Cgit status
Dgit log
How do you see all changes (staged and unstaged) compared to the last commit?
Agit diff
Bgit diff HEAD
Cgit diff --staged
Dgit show
What symbol in git diff output indicates a line was removed?
A*
B+
C-
D#
How to limit git diff output to a single file?
Agit diff filename
Bgit diff --file filename
Cgit diff --only filename
Dgit diff -f filename
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.