This question has already been answered:

Is it possible to roll back to any commit in history? I manage to roll back only to the previous commit.

When you try to roll back to an earlier commit, it gives an error:

Unable to revert commit. Trying to revert again.

Reported as a duplicate by members Nick Volynkin , m0nhawk , installero , Visman , Aries 19 Sep '15 at 5:52 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

2 answers 2

Revert is not a rollback to a commit. This is the creation of a new commit that contains reverse changes. You need to either checkout, or reset, depending on whether you just want to switch the working version to a specific commit, or even want to throw out the whole story after a particular commit.

    As PashaPash already said, git revert is a bit different from what you expect.

    This command makes changes to the project files, and then you include these changes in the commit. After the commit, the project workspace will look exactly the same as in some past commit. Logically, before you make changes, Git requires you to start "from scratch," that is, commit (make git commit ) or discard all changes. This is what the message that is output on the revert 'a error tells us.