- git revert: Creates a new commit that undoes the changes of a previous commit without altering the commit history. This is safe for shared branches.
- git reset: Moves the current branch’s head to a specific commit, potentially altering the commit history and affecting shared branches.
Example Code for git reset: To reset to a specific commit:
git reset --hard <commit-hash>