Sobes.tech
Junior — Middle

What is the purpose of using the 'git revert' command and in what situations is it applied?

sobes.tech AI

Answer from AI

The git revert command is used to create a new commit that undoes the changes made in a previous commit. Unlike git reset, which alters the commit history, git revert preserves history and is safe for collaborative work on branches.

Use git revert when you need to undo an erroneous commit but want to keep the history of changes and not disrupt other developers' work.

Example usage:

git revert <commit-hash>

This will create a new commit that reverses the changes of the specified commit.

What is the purpose of using the 'git revert' command… - sobes.tech