git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Searching all git objects
@ 2008-06-25 23:06 Sam G.
  2008-06-25 23:17 ` Shawn O. Pearce
  0 siblings, 1 reply; 6+ messages in thread
From: Sam G. @ 2008-06-25 23:06 UTC (permalink / raw)
  To: git

Hi all,

We recently had a developer make a large commit (mostly centered  
around one file) which she believed she properly pushed to a remote  
repository last week, but looking at both her repository and the  
remote repository, that commit is now nowhere to be found. If somehow  
the master branch she was working on in her repository has lost the  
reference to the commit through perhaps some errant rebasing, then  
perhaps an object containing the commit (or an object containing the  
file in that commit) still exists somewhere inside her .git/objects  
directory? We haven't done any git-gc recently. If so, how can I  
search through every single git object in her objects directory,  
searching for perhaps a specific part of the commit string, a line in  
the code or the filename of the file which was changed? Any help with  
this would be greatly appreciated. Thanks!

-Sam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Searching all git objects
  2008-06-25 23:06 Searching all git objects Sam G.
@ 2008-06-25 23:17 ` Shawn O. Pearce
  2008-06-25 23:32   ` Tarmigan
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2008-06-25 23:17 UTC (permalink / raw)
  To: Sam G.; +Cc: git

"Sam G." <ceptorial@comcast.net> wrote:
> We recently had a developer make a large commit (mostly centered  
> around one file) which she believed she properly pushed to a remote  
> repository last week, but looking at both her repository and the  
> remote repository, that commit is now nowhere to be found. If somehow  
> the master branch she was working on in her repository has lost the  
> reference to the commit through perhaps some errant rebasing, then  
> perhaps an object containing the commit (or an object containing the  
> file in that commit) still exists somewhere inside her .git/objects  
> directory? We haven't done any git-gc recently. If so, how can I  
> search through every single git object in her objects directory,  
> searching for perhaps a specific part of the commit string, a line in  
> the code or the filename of the file which was changed? Any help with  
> this would be greatly appreciated. Thanks!

Odds are it is in her HEAD reflog.  You can look for it with
`git log -g`.  If you know some part of the commit message you
may be able to filter it down with `git log -g --grep=X` or part
of the change with `git log -g -SX`.

A coworker just did something like that today and lost his change;
looking in the HEAD reflog and cherry-picking the commit recovered
it quite easily.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Searching all git objects
  2008-06-25 23:17 ` Shawn O. Pearce
@ 2008-06-25 23:32   ` Tarmigan
  2008-06-26  0:49     ` Sam G.
  0 siblings, 1 reply; 6+ messages in thread
From: Tarmigan @ 2008-06-25 23:32 UTC (permalink / raw)
  To: Sam G.; +Cc: Paul Mackerras, Shawn O. Pearce, git

On Wed, Jun 25, 2008 at 4:17 PM, Shawn O. Pearce <spearce@spearce.org> wrote:
> "Sam G." <ceptorial@comcast.net> wrote:
>> We recently had a developer make a large commit (mostly centered
>> around one file) which she believed she properly pushed to a remote
>> repository last week, but looking at both her repository and the
>> remote repository, that commit is now nowhere to be found. If somehow
>> the master branch she was working on in her repository has lost the
>> reference to the commit through perhaps some errant rebasing, then
>> perhaps an object containing the commit (or an object containing the
>> file in that commit) still exists somewhere inside her .git/objects
>> directory? We haven't done any git-gc recently. If so, how can I
>> search through every single git object in her objects directory,
>> searching for perhaps a specific part of the commit string, a line in
>> the code or the filename of the file which was changed? Any help with
>> this would be greatly appreciated. Thanks!
>
> Odds are it is in her HEAD reflog.  You can look for it with
> `git log -g`.  If you know some part of the commit message you
> may be able to filter it down with `git log -g --grep=X` or part
> of the change with `git log -g -SX`.

If it helps, I like viewing the reflog with gitk.  Like this:
gitk $(git log -g --pretty=format:%H)

Is there a shorter way to do this with gitk?  It would be awesome to
have `gitk -g` .

-Tarmigan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Searching all git objects
  2008-06-25 23:32   ` Tarmigan
@ 2008-06-26  0:49     ` Sam G.
  2008-06-26  1:00       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Sam G. @ 2008-06-26  0:49 UTC (permalink / raw)
  To: Tarmigan; +Cc: Paul Mackerras, Shawn O. Pearce, git

On Jun 25, 2008, at 4:32 PM, Tarmigan wrote:

> On Wed, Jun 25, 2008 at 4:17 PM, Shawn O. Pearce  
> <spearce@spearce.org> wrote:
>> "Sam G." <ceptorial@comcast.net> wrote:
>>> We recently had a developer make a large commit (mostly centered
>>> around one file) which she believed she properly pushed to a remote
>>> repository last week, but looking at both her repository and the
>>> remote repository, that commit is now nowhere to be found. If  
>>> somehow
>>> the master branch she was working on in her repository has lost the
>>> reference to the commit through perhaps some errant rebasing, then
>>> perhaps an object containing the commit (or an object containing the
>>> file in that commit) still exists somewhere inside her .git/objects
>>> directory? We haven't done any git-gc recently. If so, how can I
>>> search through every single git object in her objects directory,
>>> searching for perhaps a specific part of the commit string, a line  
>>> in
>>> the code or the filename of the file which was changed? Any help  
>>> with
>>> this would be greatly appreciated. Thanks!
>>
>> Odds are it is in her HEAD reflog.  You can look for it with
>> `git log -g`.  If you know some part of the commit message you
>> may be able to filter it down with `git log -g --grep=X` or part
>> of the change with `git log -g -SX`.
>
> If it helps, I like viewing the reflog with gitk.  Like this:
> gitk $(git log -g --pretty=format:%H)
>
> Is there a shorter way to do this with gitk?  It would be awesome to
> have `gitk -g` .
>
> -Tarmigan

Unfortunately I can't seem to find it in here. So at this point it  
seems about 99% likely that it was never committed. Does this command  
search across all branches or only the one you have checked out when  
you run the git log command? And, just in case, is there any way to  
search raw objects for text, either commit text, file name or content?  
Thanks very much!

-Sam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Searching all git objects
  2008-06-26  0:49     ` Sam G.
@ 2008-06-26  1:00       ` Junio C Hamano
  2008-06-26 22:23         ` Sam G.
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-06-26  1:00 UTC (permalink / raw)
  To: Sam G.; +Cc: Tarmigan, Paul Mackerras, Shawn O. Pearce, git

"Sam G." <ceptorial@comcast.net> writes:

> And, just in case, is there any way to
> search raw objects for text, either commit text, file name or content?
> Thanks very much!

Or run "git lost-found" and grep for blobs in .git/lost-found/other/*

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Searching all git objects
  2008-06-26  1:00       ` Junio C Hamano
@ 2008-06-26 22:23         ` Sam G.
  0 siblings, 0 replies; 6+ messages in thread
From: Sam G. @ 2008-06-26 22:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Tarmigan, Paul Mackerras, Shawn O. Pearce, git

git-lost-found actually did it... she had git-stashed it a number of  
times throughout development, so through some grepping of the lost- 
found objects, we were able to find a very close version. What a  
relief! Thanks to everyone for your help!

-Sam


On Jun 25, 2008, at 6:00 PM, Junio C Hamano wrote:

> "Sam G." <ceptorial@comcast.net> writes:
>
>> And, just in case, is there any way to
>> search raw objects for text, either commit text, file name or  
>> content?
>> Thanks very much!
>
> Or run "git lost-found" and grep for blobs in .git/lost-found/other/*

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-26 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-25 23:06 Searching all git objects Sam G.
2008-06-25 23:17 ` Shawn O. Pearce
2008-06-25 23:32   ` Tarmigan
2008-06-26  0:49     ` Sam G.
2008-06-26  1:00       ` Junio C Hamano
2008-06-26 22:23         ` Sam G.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).