0
0
Gitdevops~5 mins

git add for staging files - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the git add command do?
It moves changes in your files into the staging area, preparing them to be saved in the next commit.
Click to reveal answer
beginner
How do you stage a single file named index.html?
Use the command git add index.html to stage that specific file.
Click to reveal answer
intermediate
What is the difference between git add . and git add -A?
git add . stages new and modified files in the current directory and below, but not deletions. git add -A stages all changes including deletions everywhere.
Click to reveal answer
intermediate
Can git add be used to stage parts of a file?
Yes, using git add -p lets you choose specific changes (hunks) inside files to stage.
Click to reveal answer
beginner
Why is staging files useful before committing?
Staging lets you control exactly which changes go into your next commit, helping keep commits clear and organized.
Click to reveal answer
What does git add do?
AMoves changes to the staging area
BDeletes files from the repository
CCommits changes to the repository
DCreates a new branch
Which command stages all changes including deletions?
Agit add .
Bgit add -p
Cgit commit -a
Dgit add -A
How do you stage only part of a file's changes?
Agit add .
Bgit add -p
Cgit commit -m
Dgit push
What happens if you run git add on a file that has no changes?
AIt does nothing
BIt stages the file anyway
CIt deletes the file
DIt commits the file
Why should you use staging before committing?
ATo delete files
BTo push changes to remote
CTo control which changes go into the commit
DTo create a new branch
Explain what the git add command does and why it is important in the Git workflow.
Think about how you prepare things before saving them permanently.
You got /3 concepts.
    Describe the difference between git add . and git add -A.
    One includes deletions, the other does not.
    You got /2 concepts.