It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I easily keep track of the status of Git submodules?

In SouceTree (latest version) if I make a change to some code in a submodule there appears to be no indication at all in the main repository of that change. I'd have to remember to open the submodule to see it.

Am I missing something? Is this by design? We're looking at using submodules in some scenarios where the code there will be updated, but I'm afraid without some kind of visual indicator in the root project that people will forget to check in their submodule code changes.

2 answers

0 votes
Steve Streeting Oct 25, 2012

Git actually ignores uncommitted changes to any nested submodules until you commit those changes, at which point it shows up in the parent repo as a change to the submodule commit that you're tracking.

However, SourceTree supplements this by checking if there are uncommitted changes to your submodules when you try to commit or push the parent. This check is optional (you can disable it in Preferences > Git > Check submodules before commit & push) because some people don't like the extra time it takes to check this when you hit commit/push, but it can be very useful in the kinds of circumstances you describe.

So although you won't see uncommitted changes to submodules in the parent repo, you will get reminded about them when you try to commit or push. SourceTree even lets you commit the submodule changes as a nested dialog inside the parent commit dialog when this occurs so you can do it all in one joined-up sequence.

Hope that helps.

Steve Streeting Oct 25, 2012

Just to clarify, the check happens when you confirm the commit / push dialog in the parent repo.

0 votes
Steve Streeting Oct 25, 2012

Oh, and I totally forgot that there's something else - in the sidebar, SourceTree queries submodule state for you and will display an annotation of '...' if there are uncommitted changes, like so:

If you've committed and haven't pushed, it's an up arrow.

Filippo Bollini Aug 09, 2016

Is this still true? I am using version 1.9.6.1 under Windows and I see no hint in the SUBMODULES section of the main repo regarding the state of its submodules.

Many thanks,

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Sourcetree

[dev team] Sourcetree for Windows 2019 Preview - Dark Theme

Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going.  The ...

1,935 views 14 18
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you