4

I did find an old question that answers this to some extent, but it's not entirely helpful as it stands:

how can I find out if a git submodule has new commits

Mostly I was hoping that git has changed since 2012 enough that this is easier.

When I do a git status with my current setup I get two types of output. The usual lines

modified: path/to/submodule (new commits)

And some extra info about the submodules like this

* path/to/submodule/
  < upstream repo
  < added more commits
  < you should update this submodule

* path/to/submodule/
  > These commits
  > don't exist upstream
  > you should commit this submodule

Git seems to know exactly what is going on, but I don't seem to have the tool to determine this myself.

My goal is to know for each submodule whether I should commit it, update it, or manually investigate because there's a mix of > and < in there. I'm about to write a script based on heuristics, which feels bad, so better ideas are gratefully received.

$ git --version
git version 1.8.5.3
Community
  • 1
  • 1
Altreus
  • 5,759
  • 4
  • 27
  • 27

1 Answers1

0

You can try, from the parent repo:

git config status.submodulesummary -1
git status --long

That should display any commit of your submodule not yet pushed to the submodule upstream repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This just gives me the output I've already got. Submodules are listed as (new commits) regardless of whether they're ahead or behind. – Altreus Apr 25 '14 at 10:41