Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Port subtree configuration between clients...

I've set up subtrees with the new support in SourceTree, but if I clone the repository again to another location on my machine (simulating a second user), none of the subtree configuration appears. Is there planned support for this and is there anything I can do in the meantime? (for example, if I knew where the subtree information was stored, I'm guessing I could replicate the info myself)

2 answers

1 accepted

1 vote
Answer accepted

Hi Micah,

The subtree concept on a whole revolves around the subtree being completely 'detached' from your repository. By this I mean that your Git repository knows nothing about the subtree. It holds no metadata to the location it came from, or its name et cetera. This is a good thing because it avoids confusing configurations that led to many of the problems people experienced using submodules.

SourceTree saves the subtree metadata in its own configuration file in the 'sourcetreeconfig' file in the '.git' folder, but this isn't committed to your git repository as it shouldn't be.

Generally you'd have to setup your links again which SourceTree allows as the folder will already exist. You can just create a new subtree but specify the existing directory as a result of the subtree which will then allow you to create a link. This is partly why this feature exists, for cases like these.

Other than that, it's impossible for SourceTree to know because Git repositories don't store the information required for SourceTree to be able to set up the subtrees.


Thanks Kieran. I pretty much understood that the subtree concept was a bit of an artificial construct outside of GIT, but wanted to be able to capture/propagate the configuration in some reasonable way. Looking at the sourcetreeconfig file, it looks like this will serve my purposes. Might be nice in the future if SourceTree had some way to help with this... maybe just give you an option to store and use this info in a tracked config file at the root of the repository or something like that.

Isn't the point of the subtree that the code in the subtree can still pull updates from its original remote? Without saving the metadata then the project in which the subtree was first set up can see these changes, but cloned repos cannot. Very confusing.

I also would like to propagate the subtrees between clients. Could you store the data somewhere textually so that it could be imported to another client? Bit annoying, having to enter it all again.

One way to solve this would be to support git-subrepo:

This is how I can share subtrees between repos using the command-line. Perhaps if this were present you could use the metadata instead of your own format. And perhaps export to this format? (git subrepo init xxx).

Perhaps you could incorporate this tool into your own command-line so this works for everyone?

WOW.  git-subrepo sounds awesome (reading the dot point features).  If the feature list is accurate then in claims to solve most/all of the issues using submodules and subtrees.

Is there any reason why this hasn't been adopted by the git and/or Atlassian community?

Suggest an answer

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

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,146 views 5 13
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