Git go to previous commit
Check last commits
git log --oneline -n <N>
Get previous commit locally, WITHOUT modifying HEAD.
git checkout <commit-hash> -- .
Updates all files in the current directory and subdirectories to match the specified commit. HEAD stays on your current branch — you’re not switching commits or branches. Only the working directory is affected, not your branch pointer.
Without -- ., git checks out the entire commit and puts you in a detached HEAD state.