{"thread":{"id":"14155","subject":"Searching all git objects","startedAt":"2008-06-25T23:06:31Z","lastAt":"2008-06-26T22:23:07Z","messageCount":6,"participants":["Sam G.","Shawn O. Pearce","Tarmigan","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"81205","messageId":"E99352BE-5C43-437E-A5E6-622BEEA03DFA@comcast.net","threadId":"14155","inReplyTo":null,"subject":"Searching all git objects","fromName":"Sam G.","fromEmail":"ceptorial@comcast.net","sentAt":"2008-06-25T23:06:31Z","receivedAt":"2008-06-25T23:06:31Z","isPatch":false,"sender":{"key":"ceptorial@comcast.net","avatar":null},"body":"Hi all,\n\nWe recently had a developer make a large commit (mostly centered  \naround one file) which she believed she properly pushed to a remote  \nrepository last week, but looking at both her repository and the  \nremote repository, that commit is now nowhere to be found. If somehow  \nthe master branch she was working on in her repository has lost the  \nreference to the commit through perhaps some errant rebasing, then  \nperhaps an object containing the commit (or an object containing the  \nfile in that commit) still exists somewhere inside her .git/objects  \ndirectory? We haven't done any git-gc recently. If so, how can I  \nsearch through every single git object in her objects directory,  \nsearching for perhaps a specific part of the commit string, a line in  \nthe code or the filename of the file which was changed? Any help with  \nthis would be greatly appreciated. Thanks!\n\n-Sam\n"},{"id":"81208","messageId":"20080625231742.GT11793@spearce.org","threadId":"14155","inReplyTo":"E99352BE-5C43-437E-A5E6-622BEEA03DFA@comcast.net","subject":"Re: Searching all git objects","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-06-25T23:17:42Z","receivedAt":"2008-06-25T23:17:42Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Sam G.\" <ceptorial@comcast.net> wrote:\n> We recently had a developer make a large commit (mostly centered  \n> around one file) which she believed she properly pushed to a remote  \n> repository last week, but looking at both her repository and the  \n> remote repository, that commit is now nowhere to be found. If somehow  \n> the master branch she was working on in her repository has lost the  \n> reference to the commit through perhaps some errant rebasing, then  \n> perhaps an object containing the commit (or an object containing the  \n> file in that commit) still exists somewhere inside her .git/objects  \n> directory? We haven't done any git-gc recently. If so, how can I  \n> search through every single git object in her objects directory,  \n> searching for perhaps a specific part of the commit string, a line in  \n> the code or the filename of the file which was changed? Any help with  \n> this would be greatly appreciated. Thanks!\n\nOdds are it is in her HEAD reflog.  You can look for it with\n`git log -g`.  If you know some part of the commit message you\nmay be able to filter it down with `git log -g --grep=X` or part\nof the change with `git log -g -SX`.\n\nA coworker just did something like that today and lost his change;\nlooking in the HEAD reflog and cherry-picking the commit recovered\nit quite easily.\n\n-- \nShawn.\n"},{"id":"81212","messageId":"905315640806251632m416a2406x301b857ec7faf09d@mail.gmail.com","threadId":"14155","inReplyTo":"20080625231742.GT11793@spearce.org","subject":"Re: Searching all git objects","fromName":"Tarmigan","fromEmail":"tarmigan+git@gmail.com","sentAt":"2008-06-25T23:32:56Z","receivedAt":"2008-06-25T23:32:56Z","isPatch":false,"sender":{"key":"tarmigan+git@gmail.com","avatar":null},"body":"On Wed, Jun 25, 2008 at 4:17 PM, Shawn O. Pearce <spearce@spearce.org> wrote:\n> \"Sam G.\" <ceptorial@comcast.net> wrote:\n>> We recently had a developer make a large commit (mostly centered\n>> around one file) which she believed she properly pushed to a remote\n>> repository last week, but looking at both her repository and the\n>> remote repository, that commit is now nowhere to be found. If somehow\n>> the master branch she was working on in her repository has lost the\n>> reference to the commit through perhaps some errant rebasing, then\n>> perhaps an object containing the commit (or an object containing the\n>> file in that commit) still exists somewhere inside her .git/objects\n>> directory? We haven't done any git-gc recently. If so, how can I\n>> search through every single git object in her objects directory,\n>> searching for perhaps a specific part of the commit string, a line in\n>> the code or the filename of the file which was changed? Any help with\n>> this would be greatly appreciated. Thanks!\n>\n> Odds are it is in her HEAD reflog.  You can look for it with\n> `git log -g`.  If you know some part of the commit message you\n> may be able to filter it down with `git log -g --grep=X` or part\n> of the change with `git log -g -SX`.\n\nIf it helps, I like viewing the reflog with gitk.  Like this:\ngitk $(git log -g --pretty=format:%H)\n\nIs there a shorter way to do this with gitk?  It would be awesome to\nhave `gitk -g` .\n\n-Tarmigan\n"},{"id":"81219","messageId":"321F18C8-351F-4E91-9F00-CFE2711B67D1@comcast.net","threadId":"14155","inReplyTo":"905315640806251632m416a2406x301b857ec7faf09d@mail.gmail.com","subject":"Re: Searching all git objects","fromName":"Sam G.","fromEmail":"ceptorial@comcast.net","sentAt":"2008-06-26T00:49:45Z","receivedAt":"2008-06-26T00:49:45Z","isPatch":false,"sender":{"key":"ceptorial@comcast.net","avatar":null},"body":"On Jun 25, 2008, at 4:32 PM, Tarmigan wrote:\n\n> On Wed, Jun 25, 2008 at 4:17 PM, Shawn O. Pearce  \n> <spearce@spearce.org> wrote:\n>> \"Sam G.\" <ceptorial@comcast.net> wrote:\n>>> We recently had a developer make a large commit (mostly centered\n>>> around one file) which she believed she properly pushed to a remote\n>>> repository last week, but looking at both her repository and the\n>>> remote repository, that commit is now nowhere to be found. If  \n>>> somehow\n>>> the master branch she was working on in her repository has lost the\n>>> reference to the commit through perhaps some errant rebasing, then\n>>> perhaps an object containing the commit (or an object containing the\n>>> file in that commit) still exists somewhere inside her .git/objects\n>>> directory? We haven't done any git-gc recently. If so, how can I\n>>> search through every single git object in her objects directory,\n>>> searching for perhaps a specific part of the commit string, a line  \n>>> in\n>>> the code or the filename of the file which was changed? Any help  \n>>> with\n>>> this would be greatly appreciated. Thanks!\n>>\n>> Odds are it is in her HEAD reflog.  You can look for it with\n>> `git log -g`.  If you know some part of the commit message you\n>> may be able to filter it down with `git log -g --grep=X` or part\n>> of the change with `git log -g -SX`.\n>\n> If it helps, I like viewing the reflog with gitk.  Like this:\n> gitk $(git log -g --pretty=format:%H)\n>\n> Is there a shorter way to do this with gitk?  It would be awesome to\n> have `gitk -g` .\n>\n> -Tarmigan\n\nUnfortunately I can't seem to find it in here. So at this point it  \nseems about 99% likely that it was never committed. Does this command  \nsearch across all branches or only the one you have checked out when  \nyou run the git log command? And, just in case, is there any way to  \nsearch raw objects for text, either commit text, file name or content?  \nThanks very much!\n\n-Sam\n"},{"id":"81220","messageId":"7v7icdvwml.fsf@gitster.siamese.dyndns.org","threadId":"14155","inReplyTo":"321F18C8-351F-4E91-9F00-CFE2711B67D1@comcast.net","subject":"Re: Searching all git objects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-26T01:00:02Z","receivedAt":"2008-06-26T01:00:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Sam G.\" <ceptorial@comcast.net> writes:\n\n> And, just in case, is there any way to\n> search raw objects for text, either commit text, file name or content?\n> Thanks very much!\n\nOr run \"git lost-found\" and grep for blobs in .git/lost-found/other/*\n"},{"id":"81331","messageId":"4F53E903-38EF-464F-919D-42AD5A9F39B4@comcast.net","threadId":"14155","inReplyTo":"7v7icdvwml.fsf@gitster.siamese.dyndns.org","subject":"Re: Searching all git objects","fromName":"Sam G.","fromEmail":"ceptorial@comcast.net","sentAt":"2008-06-26T22:23:07Z","receivedAt":"2008-06-26T22:23:07Z","isPatch":false,"sender":{"key":"ceptorial@comcast.net","avatar":null},"body":"git-lost-found actually did it... she had git-stashed it a number of  \ntimes throughout development, so through some grepping of the lost- \nfound objects, we were able to find a very close version. What a  \nrelief! Thanks to everyone for your help!\n\n-Sam\n\n\nOn Jun 25, 2008, at 6:00 PM, Junio C Hamano wrote:\n\n> \"Sam G.\" <ceptorial@comcast.net> writes:\n>\n>> And, just in case, is there any way to\n>> search raw objects for text, either commit text, file name or  \n>> content?\n>> Thanks very much!\n>\n> Or run \"git lost-found\" and grep for blobs in .git/lost-found/other/*\n"}]}