0
0
Gitdevops~5 mins

Difference between reset and revert in Git - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What does the git reset command do?

git reset moves the current branch pointer to a specified commit, changing the commit history. It can also modify the staging area and working directory depending on options used.

Click to reveal answer
beginner
What is the purpose of git revert?

git revert creates a new commit that undoes the changes introduced by a previous commit, preserving the commit history.

Click to reveal answer
intermediate
How does git reset affect commit history compared to git revert?

git reset rewrites commit history by moving the branch pointer backward, potentially removing commits. git revert keeps history intact by adding a new commit that reverses changes.

Click to reveal answer
beginner
Which command is safer to use on a shared public branch: git reset or git revert?

git revert is safer on shared branches because it preserves history and avoids rewriting commits others may have based work on.

Click to reveal answer
intermediate
Can git reset modify the working directory and staging area?

Yes, depending on the mode (--soft, --mixed, --hard), git reset can change the staging area and working directory along with moving the branch pointer.

Click to reveal answer
What does git revert do?
ACreates a new commit that undoes a previous commit
BMoves the branch pointer to an earlier commit
CDeletes commits permanently
DResets the staging area only
Which command rewrites commit history by moving the branch pointer?
Agit commit
Bgit revert
Cgit reset
Dgit merge
Which is safer to use on a shared branch?
Agit revert
Bgit reset --soft
Cgit reset --hard
Dgit clean
What does git reset --hard do?
ADeletes untracked files
BMoves branch pointer and resets staging area and working directory
CCreates a new commit
DOnly moves branch pointer
Does git revert remove commits from history?
ANo, it only resets staging area
BYes, it deletes commits
CYes, it moves branch pointer
DNo, it adds a new commit that undoes changes
Explain the difference between git reset and git revert in simple terms.
Think about how each command affects commit history and collaboration.
You got /4 concepts.
    When would you choose to use git revert instead of git reset?
    Consider teamwork and the impact on others' work.
    You got /4 concepts.