1

Is there any straight forward git command that I can use to get all the references of a submodule in my parent repo. Looking to find all gitlinks to a specified submodule in my parent repo. Something like git ls-tree that enlists all references.

Ritik Kumar
  • 61
  • 1
  • 9
  • You mean, beside the `git submodule status --recursive` mentioned in https://stackoverflow.com/a/23490756/6309? – VonC Jun 09 '17 at 06:59
  • @VonC, this would give me the SHAs for all submodules in the current branch. I'm looking to get all the references to one specific submodule. Let's say the submodule **X** is referenced in commits **a, b, c** in the parent repo. I need to get a list of all these commits. – Ritik Kumar Jun 09 '17 at 09:35

1 Answers1

0

Let's say the submodule X is referenced in commits a, b, c in the parent repo. I need to get a list of all these commits.

You can for commits where X was added or deleted, using a diff filter:

git log --diff-filter=AD -- X

(note: X, not X/)

Then you can list all commits between the one where X was introduced and the one where it was deleted

git rev-list A ^B
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Note: getting commits between 2 commits can be a bit tricky: https://stackoverflow.com/q/34541072/6309 – VonC Jun 09 '17 at 10:24