Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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 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.

like image 921
Karthick Avatar asked Oct 30 '10 04:10

Karthick


People also ask

How do I create multiple repositories in one project?

It is a combination of two Git tools that you can use to manage multiple repositories within one project. The two tools are HelixTeamHub and Helix4Git Do. Here, HelixTeamHub lets you work with multiple repositories, whereas the developers can use Helix4Git to contribute to the sub-projects or repositories.


2 Answers

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
like image 123
Brian Campbell Avatar answered Oct 05 '22 16:10

Brian Campbell


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.

like image 27
meagar Avatar answered Oct 05 '22 15:10

meagar