What does git revert do?
a) Creates a new commit that undoes the changes of a previous commit
b) Deletes the most recent commit
c) Resets the repository to a specific commit
d) Moves the HEAD pointer to the previous commit
Answer:
a) Creates a new commit that undoes the changes of a previous commit
Explanation:
The git revert command creates a new commit that undoes the changes introduced by a previous commit. It leaves the commit history intact, unlike git reset, which modifies the history.
For example, running git revert abc123 will create a new commit that reverts the changes made in the commit with hash abc123.
This command is ideal when you need to undo changes but still want to preserve the commit history for future reference.