git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Commit ID of a branch

From
Guillermo Gonzalez <guillermog@tricuspide.com>
Date
Aug 17, 2010, 12:35 UTC
Message-ID
<AANLkTikdVh9-60UjJW3vOp7jPA8_D_L+GqQ-9B5tcVeB@mail.gmail.com>
In-Reply-To
<4C69CD2C.9000700@gmail.com>
Thank you!
On 17 August 2010 01:43, Chris Packham <judge.packham@gmail.com> wrote:
Show 31 quoted lines
> On 16/08/10 14:19, Guillermo wrote:
>> Hello,
>>
>> I want to write a script what checks in all my projects which is the submodule
>> commit that is registered in every git repo.
>>
>> Lets say we have the following structure:
>>
>> project1
>> - submodule1
>> project2
>> - submodule1
>>
>> I want to find out what file within the .git dir of every project contains the
>> proper submodule Commit ID that should be checkout with git submodule update.
>>
>> Regards,
>> Guillermo
>
> If I understand your question correctly, what you want is
>
>  git ls-tree HEAD submodule1
>
> Which will give you the sha1 of the commit in the submodule your project
> should be pointing to. We use this in various scripts at work.
>
> It is also possible to get this information (and more) from a slightly
> friendlier submodule command if you want it for non-script usage.
>
>  git submodule status
>
-- 
Guillermo
Previous: Chris PackhamNext: Guillermo Gonzalez
Message 4 of 5 in “Commit ID of a branch”
  1. GuillermoAug 16, 2010
  2. Ævar Arnfjörð BjarmasonAug 16, 2010
  3. Chris PackhamAug 16, 2010
  4. Guillermo GonzalezAug 17, 2010
  5. Guillermo GonzalezAug 16, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.