Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I took a look at the repository in question and here's what was going on:</p> <ul> <li>At some point, rpj had performed <code>git checkout [commit id]</code>. This pointed HEAD at a loose commit rather than a recognized branch. I believe this is the "dangling HEAD" problem that CesarB is referring to.</li> <li>Not realizing this problem, he went on making changing and committing them, which bumped HEAD up every time. However, HEAD was just pointing at a dangling chain of commits, not at a recognized branch.</li> <li>When he went to push his changes, git pushed everything up to the top of master, which was only about halfway through the current tree he was on.</li> <li>Confusion ensued</li> </ul> <p>This diagram should make it more clear:</p> <pre><code> -- D -- E -- F / ^ A -- B -- C - | ^ ^ HEAD | | remote master </code></pre> <p>When he tried to push his changes, only <code>A</code> through <code>C</code> were pushed and <code>remote</code> moved up to <code>C</code>. He couldn't get commits <code>D</code> through <code>F</code> to push because they aren't referenced by a known branch.</p> <p>Here's what you see when you're in this state:</p> <pre><code>$ git branch * (no branch) master </code></pre> <p>The solution is to move <code>master</code> up to <code>F</code> in the dangling chain of commits. Here's how I did it.</p> <ul> <li><p>Create a legitimate branch for the current state:</p> <p><code>git checkout -b tmp</code></p> <ul> <li>The <code>tmp</code> branch is now pointing at commit <code>F</code> in the diagram above</li> </ul></li> <li><p>Fast-forward <code>master</code> to <code>tmp</code></p> <p><code>git checkout master</code></p> <p><code>git merge tmp</code></p> <ul> <li><code>master</code> is now pointing at commit <code>F</code>. </li> </ul></li> <li><p>Throw away your temporary branch</p> <p><code>git branch -d tmp</code></p></li> <li><p>You can happily push to the remote repository and it should send all of your changes.</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload