Jistanidiot
Jistanidiot

Reputation: 56706

How do you tell which commit, tag, and branch a git submodule should be on without checking it out

I have a project in git. It has a couple of submodules. Without going into the submodule and doing a git status or similar, is there a way to tell which commit, branch, and tag it the main project thinks it should be on?

Upvotes: 1

Views: 66

Answers (1)

CharlesB
CharlesB

Reputation: 90316

The command git submodule modulename gives you the commit without going into the submodule directory, followed by the result of git describe, which gives you most recent tag:

$ git submodule ext/fiji
808e757481874dfd493b8cc08a484235ce807ec2 ext/fiji (Fiji-Madison-23-g808e757)

For branch you have to cd in the directory, or change $GITDIR before running git status.

Upvotes: 1

Related Questions