Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - How to commit a local repository to a subfolder of another local repository?

I have a Django project that I've started some time ago and I was hosting it at bitbucket. Now I need to host it at openshift, and the way to do that is that they provide you with a git repository and every time you push they deploy automatically. The problem is that the repository comes with several top-level folder for configuration and setup, and the effective django project must be inside a subfolder called wsig/openshift.

My question is, how can I commit my changes from my local django repository to the wsig/openshift subfolder of my local openshift repository? Because I intend to continue to develop on the bitbucket/local repository

like image 429
ibrabeicker Avatar asked Oct 20 '22 02:10

ibrabeicker


1 Answers

You are probably looking for submodules. From the docs:

Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.

So you would do and would have the bitbucket repository as a seperate repository embedded in a subfolder of the openshift repository by running

git submodule add path_to_bitbucket folder/in/openshift

in the openshift repository.

You will have to run an occaisonal git submodule update to keep openshift up to date but you probably already expected extra work of that sort.

like image 58
Trudbert Avatar answered Oct 23 '22 04:10

Trudbert