开发者

How to include two different folders into the same git project?

Hey, i am working on two programs at the same time. Assume A and B are two different folders in different directories. Is it possible to have them both be a part开发者_JAVA百科 of the same git project? Because i use data from A as input for B, but since A is a web app, i've put it in public_html while B is in a different folder.


Create a git project with the two directories, put it somewhere else, and then just create symlinks in the two locations that you need the two folders.

$ ls -a myproject
. .. .git A B
$ ln -s myproject/A A
$ cd public_html
$ ln -s ../myproject/B B
$ cd ..
$ ls 
myproject A public_html
$ ls public_html
B


Short answer, you can't. Make each a separate git repository. Two different programs don't belong in the same repository anyways.

Long answer: The only way would be to create a git repo higher up in the file system at the point where the two directories share a common ancestor. This might even be the root of your file system. You could add each of the two project directories to the repo and specify everything else in .gitignore. This is obviously less than ideal.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜