TBC

Only use reset if haven't already pushed to remote as it removes commit history which will effect other developers working on the same repo. Use revert instead.

[resets to state of last commit, removes changes to working tree and removes files from stage]

git reset --hard

[resets to state of named commit , removes changes to working tree and removes files from stage]

git log --oneline

git reset --hard <commit-id>

[retains state of working tree and removes files from stage]

git reset

[defaults implicitly git reset --mixed HEAD ]

[resets to state of named commit , retains state of working tree and removes files from stage]

git log --oneline

git reset --mixed <commit-id>

[resets to state of named commit , retains state of working tree and staging area]

git log --oneline

git reset --soft <commit-id>

[undo last commit, maintain state of working tree]

git reset --soft HEAD~1

[undo resets]

git reflog

git reset HEAD@{1}

[returns to commit before the reset to the named commit was made]

[reset branch to state it was a specified number of minutes past]

git reset --hard <branch>@{“n Minutes ago”}

git reset --hard master@{"5 Minutes ago"}

https://www.atlassian.com/git/tutorials/undoing-changes/git-reset#:~:text=To%20review%2C%20git%20reset%20is,correspond%20to%20the%20three%20trees.

https://www.w3docs.com/snippets/git/how-to-undo-git-reset.html