tags:

views:

42

answers:

2

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.

A: 

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.

meagar
+5  A: 

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
Brian Campbell
+1: Nice neat solution. Of course, it wouldn't work were @Karthick working under Windows.
Johnsyweb