Git temporarily switch to a different commit:
to checkout any other commit you only need to get commit ID and use checkout command to checkout at specific branch
git checkout 0d1d7fc32
How to delete last pushed commit:
Although it is not a good thing to do and git does not provide any tool to delete pushed commit. but you can do it by using following commands.
Use the following steps.
#Checkout previuos commit using checkout command.
git checkout 0d1d7fc32
#Do a empty commit and push that commit.
git commit -m "git update remote repositoryat thsi state"
git push
Hard delete unpublished commits:
You can delete unpushed changes by doing simple following commands
git stash "some stash"
git reset --hard 0d1d7fc32
git stash pop