Question

I have two repositories for two websites, but those two websites share the same framework.

I wanted to make a dedicated repository for the framework itself but I'm not sure how would that work.

What I currently do is that I develop the framework within website1 and then copy it to website2 each time I add new features. As you can see it's not very effective...

I would like a separate repository for the framework, but I still need it to be within one of the two websites so I can keep working on it. The most important part is that I need to be able to deploy it to the other website in a simple way

What is the best solution for me? How can this be achieved?

PS: I'm using SourceTree with Bitbucket quit intensively for the past months so I'm fairly familiar with git, but I have never used the command line.

Was it helpful?

Solution

As long as your framework is limited to a subdirectory of your website, then yes, you can consider your framework a submodule of your website repo, which acts as a "parent" repo.

SourceTree supports submodules (since 1.3), and if your framework is managed in its own repo, you can add it to your website repo.
See "Using submodules and subrepositories"

add submodule in SourceTree

OTHER TIPS

As you did not mentioned about what language and framework you are working on, in general use cases, creating a git repo for your framework and use as submodules for both the projects are advisable.

Saves time over "copy pasting" and keep commits for your framework away from site specific commits so your commit logs will be cleaner, and could allows others to contribute to your framework and potentially allow the ability to open source your framework.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top