<div dir="ltr">git checkout -b eliot_path_leading_to_this_point<div><br></div><div>From there, well, add, commit</div><div><br></div><div>Then checkout the dev or master branch and just rebase or merge the eliot_path_leading_to_this_point one in it.</div><div><br></div><div>Phil</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 12, 2016 at 7:22 PM, Ben Coman <span dir="ltr"><<a href="mailto:btc@openinworld.com" target="_blank">btc@openinworld.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On Wed, Oct 12, 2016 at 8:20 AM, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br>
><br>
> I'm stuck. Don't know how I detached from the master.<br>
<br>
Maybe a good opportunity to peek under the hood to understand how it<br>
may have happened. I'm freshly enlightened from reading around the<br>
subject past couple of hours and I picked a few of the best<br>
articles...<br>
<br>
A programming analogy providing an interesting alternative to most articles...<br>
<a href="http://gitolite.com/detached-head.html" rel="noreferrer" target="_blank">http://gitolite.com/detached-<wbr>head.html</a><br>
<br>
coupled with a visual presentation...<br>
<a href="http://marklodato.github.io/visual-git-guide/index-en.html#detached" rel="noreferrer" target="_blank">http://marklodato.github.io/<wbr>visual-git-guide/index-en.<wbr>html#detached</a><br>
<br>
and bringing it together (with a comparison to Mercurial)...<br>
<a href="http://ideasintosoftware.com/git-detached-head-state-for-dummies/" rel="noreferrer" target="_blank">http://ideasintosoftware.com/<wbr>git-detached-head-state-for-<wbr>dummies/</a><br>
<br>
<br>
> I'm seeing this:<br>
><br>
> You are in 'detached HEAD' state. You can look around, make experimental<br>
> changes and commit them, and you can discard any commits you make in this<br>
> state without impacting any branches by performing another checkout.<br>
><br>
> If you want to create a new branch to retain commits you create, you may<br>
> do so (now or later) by using -b with the checkout command again. Example:<br>
><br>
> git checkout -b <new-branch-name><br>
><br>
> HEAD is now at ed4a499... CogVM source as per VMMaker.oscog-eem.1958<br>
><br>
> I want to make this the new master, and then add a commit. I'm stuck. Git mavens, help please.<br>
<br>
At <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/network" rel="noreferrer" target="_blank">https://github.com/<wbr>OpenSmalltalk/opensmalltalk-<wbr>vm/network</a><br>
I see that ed4a499 at this moment is a couple of commits back from the<br>
tip of the Cog branch around the 12 Oct<br>
but no merges after that, so without more background info I'll assume<br>
for discussion a hypothetical scenario where you wanted to throw away<br>
some local commits and in svn you would use 'checkout' (??) so you<br>
used something like 'git checkout HEAD~1' instead of 'git reset<br>
HEAD~1' to move to branch to a previous commit?? The difference is<br>
demostrated here... (use left/right arrow keys to navigate)<br>
<a href="http://gitolite.com/gcs.html#(45)" rel="noreferrer" target="_blank">http://gitolite.com/gcs.html#(<wbr>45)</a><br>
<br>
John's example seems a common way to deal with a detached HEAD. Since<br>
the commit was given to you actually could probably do...<br>
$ git checkout Cog<br>
$ git merge ed4a499<br>
except that wouldn't help the hypothetical scenario above if the Cog<br>
branch had moved forward with commits you wanted to kill. If these<br>
were only local changes, then 'reset' is probably what you need, but<br>
if the commits had already been made public, 'revert' may be more<br>
appropriate.<br>
<a href="https://www.atlassian.com/git/tutorials/resetting-checking-out-and-reverting/file-level-operations" rel="noreferrer" target="_blank">https://www.atlassian.com/git/<wbr>tutorials/resetting-checking-<wbr>out-and-reverting/file-level-<wbr>operations</a><br>
<br>
cheers -ben<br>
<br>
</blockquote></div><br></div>