git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: Guillermo <guillermog@tricuspide.com>
Cc: git@vger.kernel.org
Subject: Re: Commit ID of a branch
Date: Mon, 16 Aug 2010 16:43:40 -0700	[thread overview]
Message-ID: <4C69CD2C.9000700@gmail.com> (raw)
In-Reply-To: <loom.20100816T231539-211@post.gmane.org>

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

  parent reply	other threads:[~2010-08-16 23:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16 21:19 Commit ID of a branch Guillermo
2010-08-16 21:50 ` Ævar Arnfjörð Bjarmason
     [not found]   ` <AANLkTikD3pmMx1epkp9RdaDBCw3hfVg5RGSCai2UEvaE@mail.gmail.com>
2010-08-16 22:32     ` Guillermo Gonzalez
2010-08-16 23:43 ` Chris Packham [this message]
2010-08-17 12:35   ` Guillermo Gonzalez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C69CD2C.9000700@gmail.com \
    --to=judge.packham@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=guillermog@tricuspide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).