From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Daniel Grace <negativeview@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Lost a week?
Date: Thu, 15 Apr 2010 16:16:49 +0200 [thread overview]
Message-ID: <vpqtyrc6bse.fsf@bauges.imag.fr> (raw)
In-Reply-To: <t2s62a3a9cb1004150657g5baabb42o512e0e103d1e9596@mail.gmail.com> (Daniel Grace's message of "Thu\, 15 Apr 2010 08\:57\:50 -0500")
Daniel Grace <negativeview@gmail.com> 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/
next prev parent reply other threads:[~2010-04-15 14:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-15 13:57 Lost a week? Daniel Grace
2010-04-15 14:11 ` Michael J Gruber
2010-04-15 14:16 ` Thomas Rast
2010-04-15 14:16 ` Matthieu Moy [this message]
2010-04-15 14:29 ` Daniel Grace
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vpqtyrc6bse.fsf@bauges.imag.fr \
--to=matthieu.moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
--cc=negativeview@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.