{"thread":{"id":"26685","subject":"how can we git out source code base on git log?","startedAt":"2011-03-07T17:25:53Z","lastAt":"2011-03-08T08:22:42Z","messageCount":3,"participants":["loody","Jeff King","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"162924","messageId":"AANLkTimAPBoHJX0iZOt949xQ8HeGPXRyKfD4CDNJFv7u@mail.gmail.com","threadId":"26685","inReplyTo":null,"subject":"how can we git out source code base on git log?","fromName":"loody","fromEmail":"miloody@gmail.com","sentAt":"2011-03-07T17:25:53Z","receivedAt":"2011-03-07T17:25:53Z","isPatch":false,"sender":{"key":"miloody@gmail.com","avatar":null},"body":"Dear all:\nThere is a paragraph in faq which told us how to git out some specific tag.\n\nBut how could I check out the source at some specific point of time if\nI have no idea what the tag is or there is no tag on it.\n\nBelow I use uboot for example:\n\ncommit 3831530dcb7b71329c272ccd6181f8038b6a6dd0\nAuthor: Mikhail Zolotaryov <lebon@lebon.org.ua>\nDate:   Wed Sep 8 17:06:03 2010 +0300\n.......\n.......\n\ncommit b75a2dde47cc0ffb686e21cbf1aea4a45e23df10\nAuthor: Daniel Hobi <daniel.hobi@schmid-telecom.ch>\nDate:   Mon Oct 11 18:03:35 2010 +0200\n    tools/imls: fix comment in Makefile\n\nIs it possible I can check out the commit as\n3831530dcb7b71329c272ccd6181f8038b6a6dd0,?\n\nMeanwhile, is there any command can help me to get the history that\ncombine tag and commit such that I can know know the closest tag of\nsome specific commit?\n\ntake below for example, I will know ccdd is the closest tag of commit\nb75a2dde47cc0ffb686e21cbf1aea4a45e23df10.\n\n\ncommit 3831530dcb7b71329c272ccd6181f8038b6a6dd0\nAuthor: Mikhail Zolotaryov <lebon@lebon.org.ua>\nDate:   Wed Sep 8 17:06:03 2010 +0300\n.......\n.......\n\nTag: aabb\n\ncommit b75a2dde47cc0ffb686e21cbf1aea4a45e23df10\nAuthor: Daniel Hobi <daniel.hobi@schmid-telecom.ch>\nDate:   Mon Oct 11 18:03:35 2010 +0200\n    tools/imls: fix comment in Makefile\n......\n\nTag: ccdd\n\n\n-- \nRegards,\n\nmiloody\n"},{"id":"162927","messageId":"20110307183210.GB20411@sigill.intra.peff.net","threadId":"26685","inReplyTo":"AANLkTimAPBoHJX0iZOt949xQ8HeGPXRyKfD4CDNJFv7u@mail.gmail.com","subject":"Re: how can we git out source code base on git log?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-03-07T18:32:10Z","receivedAt":"2011-03-07T18:32:10Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 08, 2011 at 01:25:53AM +0800, loody wrote:\n\n> Below I use uboot for example:\n> \n> commit 3831530dcb7b71329c272ccd6181f8038b6a6dd0\n> Author: Mikhail Zolotaryov <lebon@lebon.org.ua>\n> Date:   Wed Sep 8 17:06:03 2010 +0300\n>\n> [...]\n>\n> Is it possible I can check out the commit as\n> 3831530dcb7b71329c272ccd6181f8038b6a6dd0,?\n\nYes, just do \"git checkout 3831530d\" (you don't need to use the whole\nid; any prefix that is unique within the repository is enough).\n\n> Meanwhile, is there any command can help me to get the history that\n> combine tag and commit such that I can know know the closest tag of\n> some specific commit?\n> \n> take below for example, I will know ccdd is the closest tag of commit\n> b75a2dde47cc0ffb686e21cbf1aea4a45e23df10.\n\nYes:\n\n  $ git describe b75a2dde\n  v2010.09-250-gb75a2dd\n\nThis means that the commit is 250 commits past v2010.09. If you want to\nknow which tags already have the commit, try:\n\n  $ git describe --contains b75a2dde\n  v2010.12-rc1~126\n\nwhich means it is inside v2010.12-rc1, and it is 126 commits back\n(following each commit's first parent).\n\nYou may also want to know all tags that contain it:\n\n  $ git tag --contains b75a2dde\n  v2010.12\n  v2010.12-rc1\n  v2010.12-rc2\n  v2010.12-rc3\n  v2011.03-rc1\n\nSee \"git help describe\" for more information.\n\n-Peff\n"},{"id":"162965","messageId":"vpq8vwqvx65.fsf@bauges.imag.fr","threadId":"26685","inReplyTo":"AANLkTimAPBoHJX0iZOt949xQ8HeGPXRyKfD4CDNJFv7u@mail.gmail.com","subject":"Re: how can we git out source code base on git log?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-03-08T08:22:42Z","receivedAt":"2011-03-08T08:22:42Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"loody <miloody@gmail.com> writes:\n\n> Is it possible I can check out the commit as\n> 3831530dcb7b71329c272ccd6181f8038b6a6dd0,?\n\nIn complement to Jeff's answer: you can also get the content of a\nspecific file without checking out with\n\n  git show 3831530dcb7b713:path/to/file\n\n> commit 3831530dcb7b71329c272ccd6181f8038b6a6dd0\n> Author: Mikhail Zolotaryov <lebon@lebon.org.ua>\n> Date:   Wed Sep 8 17:06:03 2010 +0300\n> .......\n> .......\n>\n> Tag: aabb\n\n  git log --decorate\n\ndoes this (except that tags appear after the commit ID, not after the\nlog message). You may also want to look at gitk.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}