Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Sourcetree lost track of submodules

I'm using Git Flow mode and pushing git flow branch to repository, for some reason it's stopped tracking all of the submodules even though the .git files are still intact. Why would this be?

Now when I'm moving into master or develop, then back into /feature/some-feature (where they dissapeared), I'm getting error messages. On remote branches are checked as [-] (which I still not sure what this means, assuming not tracking remote changes?).

Files are still there but how would I reattach the submodules to local repository?



4 answers

1 accepted

0 votes
Answer accepted

So it seems somewhere along the way Sourcetree got confused about what submodule was pointing where, and stopped displaying the submodules. There are two possible areas where this could have happened in my case:

  1. I accidentally added the same repository submodule into two different folders, perhaps this caused a confliction in the setup as Sourcetree config had two entries for the same repository.
  2. Sourcetree got confused after I initially added a submodule in the wrong directory, subsequently deleted it, and recreated it again in the correct directory.

Either way, the following edit to the submodule records in my repository config file did the trick (and only after commiting the latest changes):

[branch "develop"]
    remote = origin
    merge = refs/heads/develop
[submodule "assets/less/vendor"]
    url = /Users/Rob/Sites/_/Frameworks/css/grid-systems/semantic-gs
[submodule "assets/js/vendor/semantic-gs"]
    url = /Users/Rob/Sites/_/Frameworks/css/grid-systems/semantic-gs
[submodule "assets/less/vendor/semantic-gs"]
    url = /Users/Rob/Sites/_/Frameworks/css/grid-systems/semantic-gs
[submodule "assets/js/vendor/html5shiv"]
    url = /Users/Rob/Sites/_/Frameworks/js/polyfills/html5shiv

So removing the duplicates, which were obviously the source of the problem results in:

[branch "develop"]
    remote = origin
    merge = refs/heads/develop
[submodule "assets/less/vendor/semantic-gs"]
    url = /Users/Rob/Sites/_/Frameworks/css/grid-systems/semantic-gs
[submodule "assets/js/vendor/html5shiv"]
    url = /Users/Rob/Sites/_/Frameworks/js/polyfills/html5shiv

Perhaps SourceTree needs some fine-tuning when it comes to duplicate/deleted submodules?

It sounds simple compared to the other answers, but what helped me was a 'git submodule init' in the git shell (terminal) and the submodule did reapear in SourceTree.

Worked for me as well. I had one of the submodules not showing in Sourcetree

Hey Rob,

Submodules are relatively complex. The first place you'll want to check is the .gitmodules file to see if they're actually configured. When you switch branches during your git flow it may be that the .gitmodules file is being changed or completely blanked out meaning git won't be able to read your submodules. If you want to add them back you can just re-add them from the sidebar as with my previous statement they're likely not to be in your .gitmodules file. You'll need to provide the original remote clone URL though as the repository needs to know where they came from.

Hope that helps, if not just give us an update so we can look into it further :)

Thanks Kieran, I'll check that out — I'd assumed they'd be transferred over using the Git Flow method, I take it unlikely anything irretrievably broken, so long as you point the .gitmodules file to the original files? Will it pick up the .git file provided you enter in the correct path? Or will it reset the git file/folders?

The .gitmodules file is as it should be, everything's pointing to it's proper place. What now?! On the Git config file for the git-flow branch I have duplicate entries:

[branch "develop"]
	remote = origin
	merge = refs/heads/develop
[submodule "assets/less/vendor"]
	url = /Users/Rob/Sites/_/Frameworks/css/grid-systems/semantic-gs
[submodule "assets/js/vendor/semantic-gs"]
	url = /Users/Rob/Sites/_/Frameworks/css/grid-systems/semantic-gs
[submodule "assets/less/vendor/semantic-gs"]
	url = /Users/Rob/Sites/_/Frameworks/css/grid-systems/semantic-gs
[submodule "assets/js/vendor/html5shiv"]
	url = /Users/Rob/Sites/_/Frameworks/js/polyfills/html5shiv

Which all should be pointing to different paths/urls like in my correct .gitmodules file. I did accidentally put the semantic-gs into the wrong folder and deleted it a couple of times — could that be the issue? Actual .gitmodules file looks like:

[submodule "assets/js/vendor/easytabs"]
	path = assets/js/vendor/easytabs
	url =
[submodule "assets/js/vendor/hashchange"]
	path = assets/js/vendor/hashchange
	url =
[submodule "assets/less/vendor/semantic-gs"]
	path = assets/less/vendor/semantic-gs
	url = /Users/Rob/Sites/_/Frameworks/css/grid-systems/semantic-gs
[submodule "assets/js/vendor/html5shiv"]
	path = assets/js/vendor/html5shiv
	url = /Users/Rob/Sites/_/Frameworks/js/polyfills/html5shiv

Hi all,

Old issue. But thought I would mention my solution to the same problem.
[SourceTree 1.8.1 on OSX Mavericks]

To start
- ABC/
-- SubModule_A/
-- SubModule_B/
-- SubModule_C/
- DEF/
-- SubModule_A * clone from same origin as ./ABC/SubModule_A

The lead event:
- ABC exists with the three submodules ... all working fabulously
- Via command line, I cloned SubModule_A into ./DEF from the same origin (located far far away)

In SourceTree, I opened up the "MainRepoRoot" and clicked to add the ./DEF/SubModule_A as a submodule
This crashed (and reported)

Reopened SourceTree and it had lost track of all submodules

Tracking towards Resolution:

Closed (Quit) SourceTree

Command line: "git submodule" --- Returns an error
No submodule mapping found in .gitmodules for path 'DEF/SubModule_A'

Incidentally, the git command returned an exit code of '1' (error)
Thus, I believe, SourceTree aborts looking for submodules and thus they don't appear in the sidebar
Okay. Makes Sense.

The Fix:
Manually added appropriate entry to MainRepoRoot/.gitmodules
(Since I cloned several projects, I added those too)

Ran 'git submodule' again and it succeeds (exit code = 0)

Opened SourceThree

All of the submodules appear properly in the sidebar (with relative paths too - that's nifty:)

Hope this helps someone else - perhaps even myself next time I run into this and end up google'ing only to find my own answer! lol :)

Side note:
- SourceTree stability on OSX MountainLion was great - the very rare crash.
- However, since migrating to Mavericks (and using same git repos) I get far far far more frequent crashes - on the order of once a day. Hopefully there is a new version coming soon with bunches of fixes. (I'll keep reporting issues since I imagine that helps!:)

Otherwise, great work and thanks for SourceTree!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in DevOps

Step up your DevOps game webinar Q&A series - Questions answered!

  On October 21st, 2020 we hosted a webinar titled,   Step Up You DevOps Game with 4 Key Integrations for Jira and Bitbucket. We had a great showing and high engagement, but that meant th...

117 views 0 1
Read article

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