git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Lost a week?

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Apr 15, 2010, 14:11 UTC
Message-ID
<4BC71EAC.8050602@drmicha.warpmail.net>
In-Reply-To
<t2s62a3a9cb1004150657g5baabb42o512e0e103d1e9596@mail.gmail.com>
Daniel Grace venit, vidit, dixit 15.04.2010 15:57:
Show 38 quoted lines
> Appologies for not having more information. I usually use git as if
> it's just SVN with non-network checkins.
> 
> A few days ago, I pushed my git repository to github:
> 
> 127  git remote add github
> git@github.com:negativeview/Wherespresso.git [Note, this is a private
> repo]
> 128  git push github master
> 
> I then went about doing real-world business. I noticed at some point
> that when I did a `git status` it said that no branches were checked
> out. I don't remember doing anything between pushing to github and
> this state. If I did a git branch it shows something like * (no
> branch) then below that, master. I shrugged it off and did what I
> expected to fix that odd issue:
> 
> 515  git branch
> 516  git checkout master
> 
> Now, the next day, I noticed that I have no git history between the
> 6th and something I did soon after the git checkout master:
> 
> $ git log | grep Date | head -n 5
> Date:   Wed Apr 14 14:43:58 2010 -0500
> Date:   Tue Apr 6 00:42:20 2010 -0500
> Date:   Mon Apr 5 23:57:54 2010 -0500
> Date:   Mon Apr 5 07:01:26 2010 -0500
> Date:   Mon Apr 5 06:17:18 2010 -0500
> 
> 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.
> 
> Daniel
> http://www.doomstick.com
Backup now.

Most probably, you've made those commits on a detached HEAD. May you have checked out a remote branch, or a specific commit, before you went about your business on or after 6th?

git reflog (or git log -g) will be able to show you the history of your HEAD before you lost it ;)

Then you can tag those commits or 'checkout -b safehaven nameofthetopcommit' to get a branch with those commits. Now they are safe from being pruned during garbage collection.

Michael
Previous: Daniel GraceNext: Thomas Rast
Message 2 of 5 in “Lost a week?”
  1. Daniel GraceApr 15, 2010
  2. Michael J GruberApr 15, 2010
  3. Thomas RastApr 15, 2010
  4. Matthieu MoyApr 15, 2010
  5. Daniel GraceApr 15, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.