title: How can I move HEAD back to a previous location? (Detached head) & Undo commits
body: <p>In Git, I was trying to do a <code>squash commit</code> by merging in another branch and then resetting <code>HEAD</code> to the previous place via:</p>
  
  <pre><code>git reset origin/master
  </code></pre>
  
  <p>But I need to step out of this. How can I move HEAD back to the previous location?</p>
  
  <p>I have the SHA-1 fragment (<code>23b6772</code>) of the commit that I need to move it to. How can I get back to this commit?</p>