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

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.

Cheers

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: https://github.com/ingydotnet/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 Oct 23, 2018 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...

825 views 3 2
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you