Git Cloning a Sub-Directory in a Repository

2019-08-04 05:55发布

问题:

I just set up a Beanstalk account and created a repository using git.

My repository is being used to hold different websites I am working on, and it will act as the staging server.

Repository
   - website1 
   - website2
   - website3

Inside of those folders are the websites active files. So when I commit any changes, I set it up to automatically deploy to the staging server FTP.

So I have:

developmentdomain.com/website1/
developmentdomain.com/website2/
developmentdomain.com/website3/

And then once it's good to go, I can push it to the live server for that domain. My question is... if a team member gets a task to work on website2, they have the option to work on the text editor built in to Beanstalk, but if they want to clone the files, how can they clone JUST the website2 folder inside that repository?

Or am I approaching this the wrong way?

Any help is appreciated.

回答1:

You are doing it wrong, use different repositories for each website.

If the websites happen to have common code, put the common code into another repository and import it with git submodule in each website repository.