A lean approach to managing git subtrees manually. Because git-subtree clutters the history graph and git-stree still does too much for me.
I wanted the simplest possible solution that does not require anything special and that does not modify a repository beyond what's required for the most basic approach.
So you may use this script to manage a subtree. But your repository won't depend on it.
Adding a subtree:
$ git sub add https://github.com/you/component.git
This clones the repository "component" into the directory "component". The directory is now in the staging area and ready to be committed. git-sub won't make any commits.
Later, when you want to update the "component" subtree do:
$ git sub update component
The updated files are now in the staging area and can be committed.
usage: git sub add <repository> <prefix>
or: git sub update <remote>
Use the optional prefix argument to put the repository into a subfolder. By default, repositories are put into the parent repository's root folder.
Remotes don't get cloned. So you can't run
$ git sub update component
on a fresh copy. Instead, if you want to add or update a component with one command only use
$ git sub add https://github.com/you/component.git
because add also updates a component if it's already a remote.
Just put git-sub somewhere in your path and make it executable.