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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

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

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!

0 votes
KieranA Rising Star Feb 04, 2013

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

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events