What's the difference between git checkout/reset?


#1

Title says it all. So far I can't understand how git checkout HEAD differs from git reset HEAD. Can somebody explain it to me please?


#2

git checkout HEAD will restore the file in your working directory to look exactly as it did when you last made a commit. git reset HEAD This command will resets the file in the staging area to be the same as the HEAD commit. It does not discard file changes from the working directory, it just removes them from the staging area.

The staging area is where you files are after you executed git add