2

I am looking for a solution for having revision control on framework code and project code at the same time. If I am using a MVC framework, there may be specific directories where I should put my project code. I want to easily apply framework updates using revision control while still keeping project code under a separate repository.

The solution I have come up with is to clone the framework repo using git, and then create a mercurial repo on top of it, and creating .gitignores and .hgignores so that they don't pick up on each other's code.

My directory structure would in theory look something like this:

  • Framework/ (git)
    • Framework_Code/ (git)
    • Models/ (git)
      • projectModel.php (hg)
    • Views/ (git)
      • projectView.html (hg)
    • Controllers/ (git)
      • projectController.php (hg)
    • Front_Controller.php (git)

Assuming I have the correct .gitignores and .hgignores, when there are framework updates I can do a simple

git pull

And when I need to commit project code I can do

hg commit

Is this a bad workflow? Are there any easier ways to set up something like this with either git or mercurial? I'm open to alternative solutions because this seems like something that someone smarter than me would have a solution for.

2

1 Answer 1

2

This is a bad idea.

We have a similar setup in my company, but we use Git only. We have it so that the framework and project code are in separate branches, and then you can commit/push/pull independently.

The project branch is based off of the framework branch. This is convenient because if you make updates to the framework branch, you can just cleanly merge those changes into the project branch.

2
  • What would happen if you made a framework change in your project branch, how does the merge other way happen?
    – Drahcir
    Jan 17, 2014 at 3:39
  • In that case, you would need to make the change in the framework branch first, and then merge it back into the project branch. Jan 17, 2014 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.