title: Detached HEAD after checking out a branch; how to `push`?
body: <p>Here's what I did:</p>
  
  <ol>
  <li><p>Checked out a remote git repository.</p></li>
  <li><p>Added to the <code>[remote "origin]</code> section of <code>.git/config</code>:</p></li>
  </ol>
  
  <p><code>fetch = +refs/heads/release/BranchName:refs/remotes/origin/release/BranchName</code></p>
  
  <ol start="3">
  <li>Checked out the corresponding branch:</li>
  </ol>
  
  <p><code>git checkout origin/release/BranchName</code></p>
  
  <p>After that <code>git status</code> reported:</p>
  
  <blockquote>
    <p>HEAD detached from origin/release/BranchName</p>
  </blockquote>
  
  <ol start="4">
  <li><p>Added and checked in some modifications.</p></li>
  <li><p>Tries to <code>git push</code>. This resulted in the error message:</p></li>
  </ol>
  
  <blockquote>
    <p>fatal: You are not currently on a branch. To push the history leading
    to the current (detached HEAD) state now, use</p>
  
  <pre><code>git push origin HEAD:&lt;name-of-remote-branch&gt;
  </code></pre>
  </blockquote>
  
  <ol start="6">
  <li>Then I followed the suggested command:</li>
  </ol>
  
  <p><code>git push origin HEAD:origin/release/BranchName</code></p>
  
  <p>and got the following:</p>
  
  <blockquote>
    <p>error: unable to push to unqualified destination:
    origin/release/BranchName The destination refspec neither
    matches an existing ref on the remote nor begins with refs/, and we
    are unable to guess a prefix based on the source ref. error: failed to
    push some refs to 'RepositoryName`</p>
  </blockquote>
  
  <p>Thus the questions: what did I do wrong? How to fix that and push the changes?</p>