{"thread":{"id":"24855","subject":"How to query the version of a file?","startedAt":"2010-08-25T06:33:30Z","lastAt":"2010-09-28T11:26:53Z","messageCount":5,"participants":["Edmond Halley","Todd A. Jacobs","sandy2010","Michael J Gruber","Pascal Obry"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"148951","messageId":"AANLkTi=upbiD5EBumxNxG0YvSRZN0mDfvu7LeU0y0Zpw@mail.gmail.com","threadId":"24855","inReplyTo":null,"subject":"How to query the version of a file?","fromName":"Edmond Halley","fromEmail":"halleyinvent@gmail.com","sentAt":"2010-08-25T06:33:30Z","receivedAt":"2010-08-25T06:33:30Z","isPatch":false,"sender":{"key":"halleyinvent@gmail.com","avatar":null},"body":"Hi,\n\nI have a standalone repository.\nFile a.cpp has 3 versions.\nFor example, I checked out version2(HEAD^).\n> git checkout HEAD^ a.cpp\nAfter a few days, I forget which version I have checked out.\nIs there a git command that can query which version is checked out?\n\"git status\" will show there is \"changes to be committed\", but with no\nthe version information.\nThank you!\n\nBest regards,\nHalley\n"},{"id":"148969","messageId":"AANLkTi=_LaHnuZ7AYDW_TCD7fhSFFdcm_hX3GHRyvwEi@mail.gmail.com","threadId":"24855","inReplyTo":"AANLkTi=upbiD5EBumxNxG0YvSRZN0mDfvu7LeU0y0Zpw@mail.gmail.com","subject":"Re: How to query the version of a file?","fromName":"Todd A. Jacobs","fromEmail":"tjacobs@si2services.com","sentAt":"2010-08-25T13:27:44Z","receivedAt":"2010-08-25T13:27:44Z","isPatch":false,"sender":{"key":"tjacobs@si2services.com","avatar":null},"body":"On Wed, Aug 25, 2010 at 2:33 AM, Edmond Halley <halleyinvent@gmail.com> wrote:\n> I have a standalone repository.\n> File a.cpp has 3 versions.\n> For example, I checked out version2(HEAD^).\n>> git checkout HEAD^ a.cpp\n> After a few days, I forget which version I have checked out.\n> Is there a git command that can query which version is checked out?\n\nThere may be an easier way to do this, but the way I do it is (sort\nof) documented in\nhttp://www.kernel.org/pub/software/scm/git/docs/user-manual.html#Finding-comments-With-given-Content\n(should be \"commits\" instead of \"comments\", but oh well!) and can be\ntweaked to suit yourself:\n\n    git log --raw --abbrev=40 --pretty=oneline |\n    grep -B 24 `git hash-object a.cpp`\n\nThere may be other, and possibly more efficient, ways to do this, but\nit generally works for me.\n"},{"id":"151892","messageId":"1285670986056-5578850.post@n2.nabble.com","threadId":"24855","inReplyTo":"AANLkTi=upbiD5EBumxNxG0YvSRZN0mDfvu7LeU0y0Zpw@mail.gmail.com","subject":"Re: How to query the version of a file?","fromName":"sandy2010","fromEmail":"sandeeptt@yahoo.com","sentAt":"2010-09-28T10:49:46Z","receivedAt":"2010-09-28T10:49:46Z","isPatch":false,"sender":{"key":"sandeeptt@yahoo.com","avatar":null},"body":"\nI do not see the reply to this thread. I'm unable to find how to find the\nversion of a checked out file? Also, how do I view an older version?\n-- \nView this message in context: http://git.661346.n2.nabble.com/How-to-query-the-version-of-a-file-tp5459953p5578850.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"151895","messageId":"4CA1CF2F.3050903@drmicha.warpmail.net","threadId":"24855","inReplyTo":"1285670986056-5578850.post@n2.nabble.com","subject":"Re: How to query the version of a file?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-09-28T11:19:11Z","receivedAt":"2010-09-28T11:19:11Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"sandy2010 venit, vidit, dixit 28.09.2010 12:49:\n> \n> I do not see the reply to this thread. I'm unable to find how to find the\n> version of a checked out file? Also, how do I view an older version?\n\nTodd already answered to your address as well as to the list (3 days\nago). Your 2nd question is answered in the same place he pointed you to:\n\nhttp://www.kernel.org/pub/software/scm/git/docs/user-manual.html#viewing-old-file-versions\n\nNow, what do you think is the top hit when googling \"git view older\nversion\" ;)\n\nMichael\n"},{"id":"151897","messageId":"AANLkTi=pTdLA=KerZnNyfWZdWJNHE5xFWarzHQpBpDu_@mail.gmail.com","threadId":"24855","inReplyTo":"1285670986056-5578850.post@n2.nabble.com","subject":"Re: How to query the version of a file?","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2010-09-28T11:26:53Z","receivedAt":"2010-09-28T11:26:53Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"On Tue, Sep 28, 2010 at 12:49 PM, sandy2010 <sandeeptt@yahoo.com> wrote:\n> I do not see the reply to this thread. I'm unable to find how to find the\n> version of a checked out file? Also, how do I view an older version?\n\nNo response probably because there is no notion of version of a file in Git.\n\nEach commit is uniquely identified (SHA-1). A file is part of a commit.\n\nI would recommend to read some Git tutorials, books that can be found\non the Web. See Git wiki, or the online Pro Git book:\n\n   http://progit.org/book/\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"}]}