0
0
Gitdevops~5 mins

git revert to undo a commit safely - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does git revert do?

git revert creates a new commit that undoes the changes made by a previous commit, without changing the project history.

Click to reveal answer
intermediate
How is git revert different from git reset?

git revert safely undoes changes by adding a new commit, while git reset changes the commit history and can remove commits.

Click to reveal answer
beginner
What is the command to revert the last commit?

The command is git revert HEAD. It creates a new commit that reverses the last commit.

Click to reveal answer
intermediate
Why is git revert considered safe for shared repositories?

Because it does not rewrite history, it avoids conflicts with others who may have pulled the original commits.

Click to reveal answer
beginner
What happens if you revert a commit that introduced a bug?

git revert will create a new commit that removes the bug by undoing the changes from the bad commit.

Click to reveal answer
What does git revert do?
ACreates a new commit that undoes a previous commit
BDeletes the last commit permanently
CResets the branch to a previous commit without a new commit
DDeletes all commits after a certain point
Which command is safe to use on a shared repository to undo a commit?
Agit rebase -i
Bgit reset --hard
Cgit clean
Dgit revert
What does git revert HEAD do?
AReverts the last commit by creating a new commit
BDeletes the last commit without a new commit
CResets the branch to the previous commit
DShows the last commit details
Why might you prefer git revert over git reset?
ABecause it deletes commits permanently
BBecause it keeps the commit history intact
CBecause it is faster
DBecause it removes files from the disk
What happens if you revert a commit that fixed a bug?
AThe commit is deleted
BThe bug fix stays in place
CThe bug fix is undone, reintroducing the bug
DNothing happens
Explain how git revert safely undoes a commit and why it is preferred in shared projects.
Think about how changes are undone without removing commits.
You got /4 concepts.
    Describe the difference between git revert and git reset.
    Consider how each command affects project history.
    You got /4 concepts.