How does "git reset" differ from "git revert"?

  • git reset discards commits, and changes are lost
  • git reset undoes a commit, preserving changes
  • git revert discards commits, and changes are lost
  • git revert undoes a commit, preserving changes
git reset discards commits and changes are lost, whereas git revert undoes a commit while preserving changes by creating a new commit that undoes the previous changes. Reset is more powerful and should be used with caution.
Add your answer
Loading...

Leave a comment

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