Re: Lost a week?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks everyone! I had heard the phrase "detached head" before, but
didn't really understand what it is. I'm glad to note that all my
commits were there. I wasn't really worried, I knew that git had
stored it dutifully away SOMEWHERE.

I have that page bookmarked now Thomas. Unfortunately I have customer
work to do now that I am not missing work, but I promise to read and
understand it fully as soon as I'm done with that.

Daniel
http://www.doomstick.com



On Thu, Apr 15, 2010 at 9:16 AM, Matthieu Moy
<Matthieu.Moy@xxxxxxxxxxxxxxx> wrote:
> Daniel Grace <negativeview@xxxxxxxxx> writes:
>
>> github shows the same. I KNOW that there were commits (representing a
>> good bit of work) in that time. I'm sure that it's *somewhere* but I'm
>> at a complete loss as to where it is. gitk shows no side branches (nor
>> does git branch). I don't use branches really, as much as I know that
>> I should.
>
> I guess you've been on a detached HEAD for some time. Recent version
> of Git warn you this way when you enter in this state:
>
> ,----
> | Note: checking out 'HEAD^'.
> |
> | 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 a8e7ba9... foo
> `----
>
> Now, your changes are probably not lost forever: they're not reachable
> from a branch, but still there (but don't play with "git gc" until
> you're sure you've recovered all of it...). "git reflog" should give
> you the sha1 of the commit you're looking for (if you didn't really
> mess up everything, you really look for just one commit, which is the
> tip of the sequence of commits you did while on a detached HEAD, that
> is, the one just before you did "git checkout master".
>
> Then, do
>
> git branch tmp <the-sha1-you-found>
> (possibly run "gitk --all" to understand, here)
> git merge tmp
>
> to create a branch named tmp containing your commits, and merge it
> into your current branch. Naming the branch isn't strictly necessary,
> but will help in case you do anything wrong trying to merge.
>
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/
>
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]