When someone else clones your repository that has a subtree in it created with the merge strategy, the remotes needed for updating a subtree aren't there. Which steps of the subtree setup (following https://help.github.com/articles/working-with-subtree-merge as an example) need to be done in order to get subtree updates working after a clone?
To update the sub-tree explicitly and independently from upstream you'll need to re-add the remote as you've indicated. In the new cloned repo:
$ git remote add -f <subtree-repo> <subtree-repo-url>
$ git pull -s subtree <subtree-repo> <branch>
For the link you gave it would be along the lines of,
$ git clone /Users/tekkub/tmp/test my-test-clone
$ cd my-test-clone
$ git remote add -f cork git://github.com/TekNoLogic/Cork.git
$ git pull -s subtree cork master
You can also use git subtree pull
supported on the very latest version on git.
The dependency scenario is not clear from the question, but you can also simply pull the repo you've cloned to get all the subtree updates:
(repo1)
(repo2 [subtree: repo1]) -- clone --> (repo3)
repo1 $ git commit ...
repo2 $ git pull -s subtree ...
repo3 $ git pull
So when repo2
updates from repo1
you can simply git pull
in repo3
and you'll get all its commits. And you should use the commands above the dividing line only if you intend to sever the dependency between repo3
and repo2
, otherwise if you'll both pull
, push
upstream and pull -s subtree
it's easy to get into frequent unpleasant merges.