Need to go back to a previous version with everything else exactly as it was at that moment?
-
Switch to your main branch (just to be sure)
git checkout master(or: git checkout main - use whichever name your main branch has)
-
Move the branch exactly to the desired commit + delete everything newer + discard all changes
git reset --hard <commit-id> -
Remove all untracked files and directories (newly created files/folders)
git clean -fd