What is the difference between git reset and git revert?medium
Answer
Reset moves the branch pointer backward, potentially discarding commits. Revert creates a new commit that undoes a prior commit without rewriting history.
Explanation
Use revert on shared branches - it is safe because it adds to history. Reserve git reset --hard for local work you have not pushed. Resetting a shared branch forces everyone else to reconcile diverged histories.
Follow-upWhat do the --soft, --mixed, and --hard flags change in git reset?