Reputation: 119
I want my entire repository to roll back to a certain previous commit (that is 20 commits behind my latest commit).
I tried using git reset --hard <commit#>
and git revert <commit#>
Both the git commands run successfully with the message - Head is now at <commithead>
But then when I see the code in my repo, I can still see the edits I made in my latest commits. How can I remove all the edits after the particular commit I am reverting to?
Am I missing out on some step here?
Upvotes: 1
Views: 489
Reputation: 1328152
After your git reset --hard
, use to be sure the git restore
command
cd /path/to/repository
git restore -- .
That should restore (as its name implies) the working tree with what is in HEAD (and you just reset HEAD to the right commit)
Upvotes: 1