git reset to a head code example Example 1: git reset head sudo git reset --hard Head Example 2: git file reset to head git checkout HEAD -- my-file.txt