To demonstrate the various reset commands we need a repo containig 3 versions of a file:
$ git init $ echo V1 > file.txt $ git add file.txt $ git commit -m"V1" [master (root-commit) 1532be9] V1 $ echo V2 > file.txt $ git add file.txt $ git commit -m"V2" [master bd670b5] V2 $ echo V3 > file.txt $ git add file.txt $ git commit -m"V3" [master 5a4e185] V3
After these commands the repo contains 3 commits:
$ git log --oneline --decorate 5a4e185 (HEAD, master) V3 bd670b5 V2 1532be9 V1
reset acts upon the commits, the INDEX and the working tree. At this point all three are in-sync:
HEAD V3 INDEX V3 Working tree V3