{"thread":{"id":"24757","subject":"Commit ID of a branch","startedAt":"2010-08-16T21:19:11Z","lastAt":"2010-08-17T12:35:40Z","messageCount":5,"participants":["Guillermo","Ævar Arnfjörð Bjarmason","Guillermo Gonzalez","Chris Packham"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"148205","messageId":"loom.20100816T231539-211@post.gmane.org","threadId":"24757","inReplyTo":null,"subject":"Commit ID of a branch","fromName":"Guillermo","fromEmail":"guillermog@tricuspide.com","sentAt":"2010-08-16T21:19:11Z","receivedAt":"2010-08-16T21:19:11Z","isPatch":false,"sender":{"key":"guillermog@tricuspide.com","avatar":"https://gravatar.com/avatar/ddca2a3b6a23ad2f4552f145eeb7ef36559d52d958a1d804fc80a06829350b4e?d=mp&s=160"},"body":"Hello,\n\nI want to write a script what checks in all my projects which is the submodule\ncommit that is registered in every git repo.\n\nLets say we have the following structure:\n\nproject1\n- submodule1\nproject2\n- submodule1\n\nI want to find out what file within the .git dir of every project contains the\nproper submodule Commit ID that should be checkout with git submodule update.\n\nRegards,\nGuillermo\n"},{"id":"148207","messageId":"AANLkTik0FFHCdMTa_MDpdg-df2fAkpKgyVyRUCuhZ5=c@mail.gmail.com","threadId":"24757","inReplyTo":"loom.20100816T231539-211@post.gmane.org","subject":"Re: Commit ID of a branch","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-16T21:50:32Z","receivedAt":"2010-08-16T21:50:32Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Mon, Aug 16, 2010 at 21:19, Guillermo <guillermog@tricuspide.com> wrote:\n> Hello,\n>\n> I want to write a script what checks in all my projects which is the submodule\n> commit that is registered in every git repo.\n>\n> Lets say we have the following structure:\n>\n> project1\n> - submodule1\n> project2\n> - submodule1\n>\n> I want to find out what file within the .git dir of every project contains the\n> proper submodule Commit ID that should be checkout with git submodule update.\n\nThat ID is stored in a tree object, See e.g. git-ls-tree for how to get it.\n"},{"id":"148208","messageId":"AANLkTikZo5sZogpmA-xjV11HvUp-qtigedVFg1x5FC52@mail.gmail.com","threadId":"24757","inReplyTo":"AANLkTikD3pmMx1epkp9RdaDBCw3hfVg5RGSCai2UEvaE@mail.gmail.com","subject":"Re: Commit ID of a branch","fromName":"Guillermo Gonzalez","fromEmail":"guillermog@tricuspide.com","sentAt":"2010-08-16T22:32:01Z","receivedAt":"2010-08-16T22:32:01Z","isPatch":false,"sender":{"key":"guillermog@tricuspide.com","avatar":"https://gravatar.com/avatar/ddca2a3b6a23ad2f4552f145eeb7ef36559d52d958a1d804fc80a06829350b4e?d=mp&s=160"},"body":"Ooops sorry I just dont seem to understand how to get it.\n\nWhile Ive user git for two years now.. I just some have limited\nunderstanding of the internals.\n\nThanks\n"},{"id":"148209","messageId":"4C69CD2C.9000700@gmail.com","threadId":"24757","inReplyTo":"loom.20100816T231539-211@post.gmane.org","subject":"Re: Commit ID of a branch","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2010-08-16T23:43:40Z","receivedAt":"2010-08-16T23:43:40Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On 16/08/10 14:19, Guillermo wrote:\n> Hello,\n> \n> I want to write a script what checks in all my projects which is the submodule\n> commit that is registered in every git repo.\n> \n> Lets say we have the following structure:\n> \n> project1\n> - submodule1\n> project2\n> - submodule1\n> \n> I want to find out what file within the .git dir of every project contains the\n> proper submodule Commit ID that should be checkout with git submodule update.\n> \n> Regards,\n> Guillermo\n\nIf I understand your question correctly, what you want is\n\n  git ls-tree HEAD submodule1\n\nWhich will give you the sha1 of the commit in the submodule your project\nshould be pointing to. We use this in various scripts at work.\n\nIt is also possible to get this information (and more) from a slightly\nfriendlier submodule command if you want it for non-script usage.\n\n  git submodule status\n"},{"id":"148276","messageId":"AANLkTikdVh9-60UjJW3vOp7jPA8_D_L+GqQ-9B5tcVeB@mail.gmail.com","threadId":"24757","inReplyTo":"4C69CD2C.9000700@gmail.com","subject":"Re: Commit ID of a branch","fromName":"Guillermo Gonzalez","fromEmail":"guillermog@tricuspide.com","sentAt":"2010-08-17T12:35:40Z","receivedAt":"2010-08-17T12:35:40Z","isPatch":false,"sender":{"key":"guillermog@tricuspide.com","avatar":"https://gravatar.com/avatar/ddca2a3b6a23ad2f4552f145eeb7ef36559d52d958a1d804fc80a06829350b4e?d=mp&s=160"},"body":"Thank you!\n\nOn 17 August 2010 01:43, Chris Packham <judge.packham@gmail.com> wrote:\n> On 16/08/10 14:19, Guillermo wrote:\n>> Hello,\n>>\n>> I want to write a script what checks in all my projects which is the submodule\n>> commit that is registered in every git repo.\n>>\n>> Lets say we have the following structure:\n>>\n>> project1\n>> - submodule1\n>> project2\n>> - submodule1\n>>\n>> I want to find out what file within the .git dir of every project contains the\n>> proper submodule Commit ID that should be checkout with git submodule update.\n>>\n>> Regards,\n>> Guillermo\n>\n> If I understand your question correctly, what you want is\n>\n>  git ls-tree HEAD submodule1\n>\n> Which will give you the sha1 of the commit in the submodule your project\n> should be pointing to. We use this in various scripts at work.\n>\n> It is also possible to get this information (and more) from a slightly\n> friendlier submodule command if you want it for non-script usage.\n>\n>  git submodule status\n>\n\n\n\n-- \nGuillermo\n"}]}