I have a git repository on GitHub. My last three commits are changes, that I now want to rollback, but keep them in the git history.
Master-Branch:
- HEAD: 3. Change; removed one of added files, added new line in main.js
- -1 : 2. Change; removed line in one of added files
- -2 : 1. Change; Added two files
- -3 : Stuff <-- This is the status of the project that I want
Now, I tried
$ git revert <COMMIT-SHA>
but this only resets changes for that specific commit and ignores all the other commits that happend in that time.$git reset <COMMIT-SHA>
throws away all the changes that I made.
Is there a simple way to recreate the state of a specific commit, push it as a new commit and effectively get your previous state without going through all changes manually?