No description, website, or topics provided.
Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
setup.py
supertree.py

README.md

The problem

You probably already know that subtrees > submodules.

The trouble with submodules are many: they require explicit updating that you probably forget to do, they require explicit pushing you probably forget to do, submodules-in-submodules is a complete mess, and “have you tried updating the submodules?” is the new “have you tried turning it off and on again.”. And if you are being a good little programmer and working on Feature A and Feature B of an application on different branches, and these features require changes in both libraries, figuring out how to merge A and B into a release with a merged submodule is deep magic.

So fine, you use subtrees. But as many things as it has going for it, it has some problems. One of the problems is that “git subtree” doesn’t write down where it got the code from, because the code is in your repo, who needs to know where it’s from? So whenever you push and pull, you have to remember. This is fixed on some fork, but there appears to be no plan to get it into mainline.

Another problem is that if you usually use —squash, and you forget today, instead of doing something reasonable like “pull in new commits”, it does something terrible like “pull in all commits ever”. And now git status is telling you about how you’re ahead of master by hundreds of commits.

The result is that you have four separate things to think about (prefix, url, branch, squash y/n) for every subtree. That's a lot of work, so you probably don't push and pull a lot, and then the merge fails.

The solution

supertree remembers:

supertree remember library1 path/to/library1 master --squash
supertree remember library2_is_here/ user@example.com:path/to/library2 0.3
supertree remember library1/library3_inside ~/projects/library3 master —squash

And then just

supertree pull #pulls all three libraries
supertree push #pushes all three libraries

supertree creates little .supertree files (analagous to .gitmodules) that live a level up from each subtree and explain where the folder is from and how it should be pulled or pushed. You can check them into source control so that everybody knows (to/not to) use squash and knows what branch of the library we’re tracking.

Or, if you think other people suck, you can avoid checking it in. Your call.