From: Alex Riesen Date: Mon, 26 Apr 2010 18:57:38 GMT Subject: Re: "git log -- SHA-1" - how to get/simulate this functionality? Message-ID: In-Reply-To: On Mon, Apr 26, 2010 at 20:22, Eugene Sajine wrote: > On Mon, Apr 26, 2010 at 2:08 PM, Alex Riesen wrote: >> On Mon, Apr 26, 2010 at 19:56, Eugene Sajine wrote: >>> On Mon, Apr 26, 2010 at 1:54 PM, Eugene Sajine wrote: >>>> Hi, >>>> >>>> I'm wondering if there is a way to get some repo information if the >>>> only thing i know is SHA-1 (no full path to the file) >>> >>> I mean of course the SHA-1 of the blob, i.e. the result of git >>> hash-object some_file >> >> Try 'git cat-file -t '. It prints what object type is under the hash. >> Than you can use either 'git cat-file ' (the most precise version, >> which shall fail if anything is wrong), 'git cat-file -p ' or plain >> 'git show ' (which always works, unless repo's broken). >> > > Well thank you for that, but that gives me what i already know - the content. > I need to "reverse engineer" the history by having only the content > and its SHA-1 in order to indentify the last commitID and get all > relevant info (author, date etc. ) Hmm. In that case, your using of git log look like a good way to get the information. If you wanted an output format which is better suited for automated parsing, you can look at "git rev-list --pretty=format:...", let it output only commit and tree hashes, and grep the output of "git ls-tree" for your hash... > This is all about avoiding using keyword expansion (thanks CVS for bad habbits) > > Thanks, > Eugene >