To submodule or not to submodule? That is the question.

I would like to hear your opinion on using git submodule vs. plugin

I now use submodules extensively for everything under /vendor
including Rails. It's more complicated to set up than just adding
files as normal but makes it easy to update the plugins and view their
commit log. A potential problem is that the submodule repositories
need to be accessible from all the machines you're working on
(including production servers if you use Git for deployment) which is
not always convenient. Also, if you switch between long-standing
branches a lot it can become a pain when the submodules are out of
I personally clone all the repos I'm going to use into a central
collection on a server and then add them as submodules to my various
Rails projects. This way I can also maintain changes to the plugins
independent of my Rails projects.

Hope that helps with your decision.


I'm also a big fan of submodules, especially if you're going to be
actively developing Engines or plugins.

I use git.rake ( to
manage all my submodules. You can perform aggregate actions across all
submodules (like change branches, perform diffs, perform commits if
necessary). git.rake also rolls submodule commit messages into the
superproject log, and can filter 'git status' info for all the
submodules to only show what needs add/commit.

Thank you for your opinions.
My thoughts are the same.

For some projects I have used plugin install and nowadays git
Personally I do not prefer to have the same code in all my project git
repositories for plugins.
It is better to treat it like gem dependences and all my local
modifications are easy to manage.

Hi all,
I'm trying to use git submodules to track edge rails in a project I
have. And I set it up according to all examples I found on internet:

git submodule add git:// vendor/rails
git submodule init
git submodule update

Which seemed to work fine at first. But now I can't seem to update
rails to the latest edge.

git submodule update

doesn't appear to do anything. And

cd vendor/rails
git pull

just hangs there forever.
I have also tried

cd vendor/rails
git checkout head

And this reports that it is now at the HEAD, but the commit message
that it reports to be at is several days old. ??
How can I get it to sync to the bleeding edge version?

Nevermind, solved it.

git pull (from vendor/rails)

does work, it just takes forever. :slight_smile: