Git · Junior · Question 30 of 75

What does git revert <commit> do?

Explanation

History stays intact and the fix is just another commit, so revert is safe on shared branches such as main. Reset, by contrast, moves the branch and rewrites history.

Further reading

Problem with a question

Git · Junior · question 30

Test yourself

Take the Git · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz