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

Re: Searching all git objects

From
SGSam G. <ceptorial@comcast.net>
Date
Jun 26, 2008, 00:49 UTC
Message-ID
<321F18C8-351F-4E91-9F00-CFE2711B67D1@comcast.net>
In-Reply-To
<905315640806251632m416a2406x301b857ec7faf09d@mail.gmail.com>
On Jun 25, 2008, at 4:32 PM, Tarmigan wrote:
Show 32 quoted lines
> 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
Previous: TarmiganNext: Junio C Hamano
Message 4 of 6 in “Searching all git objects”
  1. Sam G.Jun 25, 2008
  2. Shawn O. PearceJun 25, 2008
  3. TarmiganJun 25, 2008
  4. Sam G.Jun 26, 2008
  5. Junio C HamanoJun 26, 2008
  6. Sam G.Jun 26, 2008

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.