title: Referring to the previous/next commit in git?
body: <p>I have seen git commands use a syntax such as <code>HEAD~</code>, but I haven't been able to find this syntax in the Git <a href="http://git-scm.com/docs" rel="noreferrer">Reference Manual</a>.</p>
  
  <p>Here is what I have understood: <code>&lt;commit&gt;~&lt;n&gt;</code> refers to the commit <em>&lt;n></em> steps earlier than <em>&lt;commit></em> (where <em>&lt;n></em> is an integer number), and <code>commit~</code> simply means the same and that <em>&lt;n></em> implicitly is one.</p>
  
  <p>Now, is this correct? In that case, does this always work? What if <em>&lt;commit></em> is the result of a merge between two branches, which commit will then <code>&lt;commit&gt;~</code> refer to? Is there some corresponding syntax for referring to the next commit or the commit <em>&lt;n></em> steps later?</p>