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

**URL:** <https://www.ruby-forum.com/t/to-submodule-or-not-to-submodule-that-is-the-question/147077>\
**Category:** Rails\
**Created:** [August 28, 2008, 10:19am UTC](https://www.ruby-forum.com/t/to-submodule-or-not-to-submodule-that-is-the-question/147077 "2008-08-28T10:19:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dejan\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@Dejan\_D](https://www.ruby-forum.com/u/Dejan_D)\
**Post date:** [August 28, 2008, 10:19am UTC](https://www.ruby-forum.com/t/to-submodule-or-not-to-submodule-that-is-the-question/147077/1 "2008-08-28T10:19:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dejan\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@Dejan\_D](https://www.ruby-forum.com/u/Dejan_D)\
**Post date:** [August 28, 2008, 2:45pm UTC](https://www.ruby-forum.com/t/to-submodule-or-not-to-submodule-that-is-the-question/147077/2 "2008-08-28T14:45:38Z")

</div>

On Aug 28, 9:19 am, Dejan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

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

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  
sync.  
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.

Andrew

---

<div class="post-metadata">

**Author:** ![Dejan\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@Dejan\_D](https://www.ruby-forum.com/u/Dejan_D)\
**Post date:** [August 28, 2008, 3:21pm UTC](https://www.ruby-forum.com/t/to-submodule-or-not-to-submodule-that-is-the-question/147077/3 "2008-08-28T15:21:23Z")

</div>

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

I use git.rake ([http://github.com/mdalessio/git-rake/tree/master](http://github.com/mdalessio/git-rake/tree/master)) 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.

---

<div class="post-metadata">

**Author:** ![Dejan\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@Dejan\_D](https://www.ruby-forum.com/u/Dejan_D)\
**Post date:** [August 29, 2008, 10:41pm UTC](https://www.ruby-forum.com/t/to-submodule-or-not-to-submodule-that-is-the-question/147077/4 "2008-08-29T22:41:19Z")

</div>

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

For some projects I have used plugin install and nowadays git  
submodules.  
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.

---

<div class="post-metadata">

**Author:** ![Dejan\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@Dejan\_D](https://www.ruby-forum.com/u/Dejan_D)\
**Post date:** [September 22, 2008, 11:06am UTC](https://www.ruby-forum.com/t/to-submodule-or-not-to-submodule-that-is-the-question/147077/5 "2008-09-22T11:06:34Z")

</div>

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:

> cd (RAILS\_ROOT)  
> git submodule add git://github.com/rails/rails.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?

---

<div class="post-metadata">

**Author:** ![Dejan\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@Dejan\_D](https://www.ruby-forum.com/u/Dejan_D)\
**Post date:** [September 22, 2008, 11:06am UTC](https://www.ruby-forum.com/t/to-submodule-or-not-to-submodule-that-is-the-question/147077/6 "2008-09-22T11:06:34Z")

</div>

Nevermind, solved it.

> git pull (from vendor/rails)

does work, it just takes forever. 🙂
