title: Git push master fatal: You are not currently on a branch
body: <p>Master is it at say commit #10. However, I ended up realizing I broke something along the way that wasn't caught by tests.</p>
  
  <p>I ended up going to commit #5, and then slowly re-did the dev of each commit and adjusted it continually to ensure it didn't re-cause the bug. Now I'm essentially back to commit #10, but with a number of changes that prevent the bug from happening.</p>
  
  <p>I now want to create commit #11 using my changes. But when I try to push to master I get </p>
  
  <pre><code>fatal: You are not currently on a branch.
  To push the history leading to the current (detached HEAD)
  state now, use
  
      git push master HEAD:&lt;name-of-remote-branch&gt;
  </code></pre>
  
  <p>Which is to be expected. But how do I actually get that to push up to my remote branch?</p>
  
  <p>I tried <code>git push origin HEAD:master</code> but then got this:</p>
  
  <pre><code>! [rejected]        HEAD -&gt; master (non-fast-forward)
  error: failed to push some refs to 'https://github.com/tomhammond/sample.git'
  hint: Updates were rejected because a pushed branch tip is behind its remote
  hint: counterpart. Check out this branch and integrate the remote changes
  hint: (e.g. 'git pull ...') before pushing again.
  hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  </code></pre>
  
  <p>When I do a <code>git status</code> I see <code>HEAD detached from 4a74ac3</code></p>