0

I have two projects and one framework. My framework now on bitbucket. My framework is in develop mode. I commit and push everyday.

I will using bitbucket to control that two projects too. I already have 3 repo

fw prjA prjB

Each repo of prjA and prjB will have a copy of fw. How I setup for each project can pull new version of framework and commit separate?

2
  • So ... you're using Git on BitBucket ... and PHP relates to this how? (The question is not really clear. Is it about PHP or how to use Git or how to setup the repositories or ...?) Commented Apr 14, 2012 at 6:25
  • PHP, I mean php fw and project. I need help to setup 3 repo Commented Apr 14, 2012 at 6:36

2 Answers 2

3

You could setup your framework project as a submodule in your prja and prjb projects.

From the git book:

Git's submodule support allows a repository to contain, as a subdirectory, a checkout of an external project.

From the root directories of prja and prjb just do:

git submodule add git://path/to/your/fw.git path/to/fw

The first path is wherever your fw git repository is, and the second is where you want fw to go in the project that is using it.

More info from the Pro Git book:

It often happens that while working on one project, you need to use another project from within it. Perhaps it’s a library that a third party developed or that you’re developing separately and using in multiple parent projects. A common issue arises in these scenarios: you want to be able to treat the two projects as separate yet still be able to use one from within the other. [...] Git addresses this issue using submodules. Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.

Sign up to request clarification or add additional context in comments.

2 Comments

How to pull new version of submodule?
Just navigate to the directory that the submodule is in and do git pull origin master.
1

You don't need 3 repositories. I think prjA and prjB are just for testing out your framework. You can try creating 2 separate branches, one for prjA and one for prjB. Let the framework be your master branch. You may locally maintain 3 copies of the same repo if you feel like (for prjA, prjB and fw development). Anytime you commit to your master branch, you can just rebase prjA and prjB.

2 Comments

It not a testing project. It's a real business project. So Is your approach good for business project?
I am also convinced now that the submodule approach is better, :). Thanks @ngm.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.