What is the difference between git reset and git revert?

  • git reset removes commits
  • git reset undoes changes in the working directory
  • git revert removes commits
  • git revert undoes changes in the working directory
The correct option is git revert. Unlike git reset, which removes commits from the branch history, git revert creates a new commit that undoes the changes introduced by a specific commit. This ensures a safer and non-destructive way to undo changes. git reset, on the other hand, can be used to move the branch pointer and potentially discard commits.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *