{"thread":{"id":"38793","subject":"Is it possible get the tag name of working copy in Git?","startedAt":"2015-03-13T07:08:12Z","lastAt":"2015-03-13T17:00:15Z","messageCount":3,"participants":["chen chang","Torsten Bögershausen","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"257637","messageId":"CAFL7HFUNMrTfLx+kj6rBiNeuLhbkPF_t32kOYYSxBP9F=eKSxQ@mail.gmail.com","threadId":"38793","inReplyTo":null,"subject":"Is it possible get the tag name of working copy in Git?","fromName":"chen chang","fromEmail":"chenchangs@gmail.com","sentAt":"2015-03-13T07:08:12Z","receivedAt":"2015-03-13T07:08:12Z","isPatch":false,"sender":{"key":"chenchangs@gmail.com","avatar":null},"body":"I want to use make file auto generate the revision number of working\ncopy from the tag name in git.\nSo as questioned in subject, I have tried to use 'git describe', it\nworks well in most case, and the output is good match my requirement.\nProblem is: when there are multiple tags on same one commit, if check\nout one of these tag, the 'git describe' only be able to return the\nmost new created tag name in that commit, instead of the real checked\nout tag.\n\nSeems 'git-describe' capture the most recent tag name by create sequence.\n\nI expect add an argument to 'git-describe' to make it get the most\nrecent tag name according to checkout status when multiple tags on one\ncommit.\n\nIs there any suggestion? Thanks!\n\n------------------------------\nChen Chang\n"},{"id":"257639","messageId":"5502AF86.9050803@web.de","threadId":"38793","inReplyTo":"CAFL7HFUNMrTfLx+kj6rBiNeuLhbkPF_t32kOYYSxBP9F=eKSxQ@mail.gmail.com","subject":"Re: Is it possible get the tag name of working copy in Git?","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2015-03-13T09:36:06Z","receivedAt":"2015-03-13T09:36:06Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 03/13/2015 08:08 AM, chen chang wrote:\n> I want to use make file auto generate the revision number of working\n> copy from the tag name in git.\nYou should have the tag name, as it is set up before running make,\nand probably feed into both \"git checkout tagXXYYXX\" and the Makefile.\n\nIf you want the \"version number\", what is this ?\nGit has a sha value, you can git it like this:\n\ngit rev-parse HEAD  | cut -b 1-9\n\nHTH\n"},{"id":"257643","messageId":"CAGZ79kaeWkVD-tCVMRYBxgG80_PHOeHKeSdpodAPqgpdiARa7Q@mail.gmail.com","threadId":"38793","inReplyTo":"5502AF86.9050803@web.de","subject":"Re: Is it possible get the tag name of working copy in Git?","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2015-03-13T17:00:15Z","receivedAt":"2015-03-13T17:00:15Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Fri, Mar 13, 2015 at 2:36 AM, Torsten Bögershausen <tboegi@web.de> wrote:\n> On 03/13/2015 08:08 AM, chen chang wrote:\n>>\n>> I want to use make file auto generate the revision number of working\n>> copy from the tag name in git.\n>\n\nMaybe you're looking for git describe?\nhttp://git-scm.com/docs/git-describe\n"}]}