reset function

Reset current HEAD to the specified state