tags:

views:

47

answers:

3

I want to add an external directory to an existing repository.

External Dir: /home/some/directory

Working Dir: /htdocs/.git

If I attempt the following command from the /htdocs dir:

git add /home/some/directory

I get an error: fatal: '/home/some/directory' is outside repository

+1  A: 

Add a symbolic link to the directory within the repository. Then, add the same.

ln -s /home/some/directory/
git add directory
Alan Haggai Alavi
But this doesn't actually track anything in the target directory. It just tracks the link.
William Pursell
So, how do I recursively track everything under the target dir?
Sly
+1  A: 

If I need to do something like that I would normally move that external file or directory into my git repo and symlink it's original location to the new one.

mv /home/some/directory /htdocs/directory
ln -s /htdocs/directory /home/some/
git add ./directory

I use this technique when I am developing a plug-in for an application that I want to keep under version control but have to store in a specific location.

csexton
A: 

Sounds like you need something like svn externals, not sure how you do it in git?

jmoz