What’s the difference between Git Revert and Reset?
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
You must login to ask question.
git revert
andgit reset
commands undo previous commits. But if you’ve already pushed your commit to a remote repository, it is recommended that you do not usegit reset
since it rewrites the history of commits. This can make working on a repository with other developers and maintaining a consistent history of commits very difficult.Instead, it is better to use
git revert
, which undoes the changes made by a previous commit by creating an entirely new commit, all without altering the history of commits.