John Rumpel
John Rumpel

Reputation: 4615

Get commit date of a given SHA1 (submodules) commit

very special problem: I have integrated submodules and I get my submodules 8-char long referenced commit state by

$ git ls-tree HEAD MY_SUBMODULE | awk '{print $3}' | cut -c -8
03B446AB

Now I want to get the commit date of the submodule, preferably in format yyyy-mm-dd. Do you have a idea how to handle this

Upvotes: 1

Views: 282

Answers (1)

VonC
VonC

Reputation: 1327912

You could use the git show command (for the committer date):

git --git-dir=/path/to/submodule/.git show --format="%ci" <commit>

The OP John Rumpel suggests in the comments:

git --git-dir=path/to/submodule/.git show --pretty=format:'%ad' --date=short <commit> 
# or
git log --git-dir=path/to/submodule/.git --pretty=format:'%ad %h' --date=short | grep <commit> 

Upvotes: 3

Related Questions