0

Current I am working on a project and I have plenty of commits on my github. The commit sequence maybe like this:

A -> B -> C -> D -> E

After working on for a while, I realize that I have done big mistake on later progress and I wish to rollback to B. How can I revert back to B and delete C, D and E?

  • You might want to check this out: https://help.github.com/en/desktop/contributing-to-projects/reverting-a-commit – CootMoon Nov 20 '19 at 17:31

1 Answers1

0

You should do a git log and copy the commit hash of B and then do git reset <commit hash you just copied>. Note that this will unstage the changes made in C, D and E. If you are really very sure about deleting these changes use a --hard flag with the reset command.

unixia
  • 4,102
  • 1
  • 19
  • 23