Git Submodules with Heroku

Since Heroku doesn't currently support submodules, one other possible way would be to use sub-tree merging.

Basically, sub-tree merging is a Git merging strategy that allows you to merge another git repository into yours, but in a subdirectory of your choosing. There's a tool called git-subtree, which tries to wrap this process in a way similar to git-submodule(1).

Other than the git-merge(1) man page, there are a few other articles that can help you with this merging strategy:

  • github:help on subtree merging
  • Pro Git Chapter 6, Section 7: Subtree Merging
  • I've also written a post called "Subtree merging and you"

There is another alternative to @Daniel Eisenhardt approach: https://stackoverflow.com/a/29464430/990356

Go to Settings > Personal access tokens and generate a personal access token with repo scope enabled.

Now you can do git clone https://[email protected]/user-or-org/repo and in the case of a submodule git submodule add https://[email protected]/user-or-org/repo

Pros:

  • very simple approach
  • token can be easily revoked
  • your real password is safe

Cons:

  • if someone has access to the token, he can access your GitHub repos (read and write)

Heroku now supports submodules.

http://devcenter.heroku.com/articles/git-submodules

However, this feature does not support submodules that are private.