Dorian Marchal
Dorian Marchal

Reputation: 635

Manage multiple git repositories at the same level?

I can't think of a good workflow for my use case :

I have a repository for my JS framework.

I would like to use this framework to make an application, keeping the ability to update my framework with git.

In fact, git submodules could work, but my framework files (and my application files) are scattered all over my directory tree.

I tried to add a remote pointing to my framework repo in my app repo in order to pull/push commits from/to my framework, but if I do that, I run into some conflicts. For example, I can't have tags with the same name in both repo. Moreover, it "pollute" my history.

A real world example : Say I have a CakePHP website. How can I update CakePHP framework with git while versionning my website with git, too ?

Ideally, I would like to push commits to the framework from the app repo (like I do with submodules).

(Sorry, I could not find a better title for this question)

Upvotes: 0

Views: 164

Answers (1)

R Phillip Castagna
R Phillip Castagna

Reputation: 896

This sounds like a bad idea from a software engineering perspective. Your framework and your website are ostensibly two different codebases (unless your "framework" is only supposed to work for this site) and so they should live in different directories, with the website referencing a pre-built version of the framework.

It'll involve some switching back and forth if you're actively developing both of them, yes, but then the code separation is a lot more clear for anyone coming up behind you.

You might want to look at using git hooks to automatically pull changes from your framework into your website code. Specifically, a post-commit hook might be handy.

Example might be something like:

#!/bin/bash

rsync -avz /path/to/framework/ /path/to/website/framework-folder

Upvotes: 3

Related Questions