When you run git checkout on a commit (specified by hash or ref) you’re telling git to make your working directory look like how it did when the snapshot was taken.

  1. Update the files in the working directory to match the tree inside the commit
  2. Update HEAD to point to the specified hash or ref