3

Possible Duplicate:
Can you share a file and it's history between two git repositories?

I have multiple rails projects (in one git), which have some common CSSs, layouts and helpers. My first solution to share those files between the projects was to set up some symlinks, but I'm not totally convinced this is the way to go. Is there some nicer solution, or are symlinks maybe fine after all?

Community
  • 1
  • 1
lucas clemente
  • 6,255
  • 8
  • 41
  • 61

4 Answers4

3

You can use git submodules to split out the common parts.

Check this out: http://railscasts.com/episodes/96-git-on-rails Or: http://git-scm.com/docs/git-submodule

Brian
  • 4,931
  • 3
  • 32
  • 55
1

Yes, symlinks is a good way to go, i would probably do that as well.

Spyros
  • 46,820
  • 25
  • 86
  • 129
  • Better to use git-subtree for this. Here is an article about how this can be done: http://igor-alexandrov.github.com/blog/2013/03/28/using-git-subtree-to-share-code-between-rails-applications/#comment-844890376 – Igor Alexandrov Mar 28 '13 at 12:10
1

-1 for symlinking. It'll do the job but not very elegantly. I would rather have a single library (gem) that has all the shared code, which you can use to include only what you need.

aceofspades
  • 7,568
  • 1
  • 35
  • 48
0

You can host them in a separate git repo, and symlink to that. This way, the common files are also managed via git. You could find a neat way to get this to work for deployment as well (capastrino etc, if you use it).

Michael De Silva
  • 3,808
  • 1
  • 20
  • 24