The first will change the branch to indicate the commit you specify. Commits that were ahead of this will be lost if there is no other link to them (branch or tag). There is a reflog (git reflog) that keeps a history of what was checked (by default, this holds the last cost for 90 days)
The second will switch the branch to what you specified. Since you specified a commit, not a local branch, you will not track any changes you make here. With the exception of reflog, you will lose those commits that were made after the first check, when you do a subsequent check other than the current commit or HEAD.
The third way you can βcancelβ a job is to put a β-β. after your second command. This will change your working tree to the state in which the files are in the ad that you specified. You will still have the same branch, and it will still point to the same commit. When you run "git status", you will see that all changes in your working directory will look as if you edited your files so that they look like they were in the ad that you specified. Upon making these changes, a new commit will be made, which effectively "cancels" what follows after the commit, if indicated. Now your current branch will point to this commit. This is good practice if others may depend on the commits that you really want to delete.
source share