1.

What is the difference between a git reset and a git revert.

Answer»
  • git revert is used to record some new commits to reverse the effect of some earlier commits/snapshot of a project.
  • Instead of REMOVING the commit from the project history, it figures out how to undo the changes introduced by the commit & appends a new commit with the resulting content in the current branch.

  • Usage: git revert <commit_id>
  • USE: To undo an ENTIRE commit from your project history; removing a bug introduced by a commit.

Reset VS Revert

  • git “reset”: resets the project to a previous snapshot ERASING the changes.
  • git “revert” does not change the project history unlike git “reset”
  • Git “revert” undoes the commit id changes and applies the undo work as a new commit id object.


Discussion

No Comment Found