[Vm-dev] reattaching a detatched git head...

phil at highoctane.be phil at highoctane.be
Wed Oct 12 18:18:09 UTC 2016


This may help grokking it.

https://git-scm.com/book/en/v2/Git-Branching-Rebasing

And do yourself a favor, install tig.

http://jonas.nitro.dk/tig/


Linux

apt-get install tig
yum install tig

OSX

brew install tig

useful commands:

tig status

or any git command piped into it.

e.g.
git log | tig

tig log would work too.

Can't live without this thing on the command line.

Little vid: https://www.youtube.com/watch?v=udCXubFr5Yo

Other useful Git beasts:

git gui
gitk






On Wed, Oct 12, 2016 at 7:22 PM, Ben Coman <btc at openinworld.com> wrote:

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


More information about the Vm-dev mailing list