Reputation: 11
Thanks for reading this question. I have a task to do, and I'm shame of it, but I can not handle it myself. That's why I'm here, to ask you give me a hand with it. So, the problem is...I have the following site structure:
ext_www
-- dev
----(site code here)
www
--(site code here)
ext_www/dev folder is the place where dve branch wanted to be located. And the www is the folder where master branch wanted to be located. So I want to build a file structure like this:
.git
ext_www
-- dev(dev branch)
----(site code here)
www(master branch)
--(site code here)
Is it possible to set .git folder in one place, then set the master branch go into the www folder and the dev branch go into the ext_www/dev folder, and at the same time to keep in the repo a pure site source code with no www or ext_www/dev folders?
Upvotes: 1
Views: 1461
Reputation: 1683
You can use git submodules:
1 - Add the first submodule:
git submodule add https://github.com/link-to/your-repo.git ext_www
2 - Checkout to dev
branch:
cd ext_www && git checkout dev
3 - Add another submodule:
cd ../ && git submodule add https://github.com/link-to/your-repo.git www
4 - Checkout to master
branch:
cd www/ && git checkout master
5 - [optional] Return to your root directory and commit all these changes.
Upvotes: 2