Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to make a hard link to a directory in OS X, but I'm running Snow Leopard 10.6.x, so some options that worked no longer do. Any suggestions?

Note: I'm using this to get the same source in multiple GIT repositories.

share|improve this question
Hardlinks to directories are a bad idea to begin with, and using it to futz with git repositories like that makes it sound even worse. – Ignacio Vazquez-Abrams Oct 3 '10 at 0:15
SVN supports "externals", perhaps something similar exists for git? – Daniel Beck Oct 3 '10 at 9:17
@Ignacio Vazquez-Abrams, it surely sounds bad. I'm open to alternatives in GIT, if you know any.... – Dan Rosenstark Oct 3 '10 at 20:43
This question was just bumped to the front page. Any news? How did you solve this issue? – Daniel Beck Mar 31 '11 at 7:38

Hard links to directories were added to HFS+ specifically to support Time Machine backups. However, most utilities do not expect them, and you should probably avoid using them yourself.

It sounds like you might be in a situation where you would benefit from using Git submodules. A submodule allows one Git repository to maintain a link to another repository. For example if your project builds a copy of libcoolstuff as part of it's own build, your directory might look like this:

|- /MyProject
    |-- .git/
    |-- libcoolstuff/
    |   |-- libcoolstuff.c
    |   |-- libcoolstuff2.c
    |-- mysource.c
    |-- ...

In this case, you might want to have libcoolstuff be a submodule:

git submodule add /path/to/repo/libcoolstuff libcoolstuff

This will create a subdirectory called libcoolstuff in your MyProject repo. The link between libcoolstuff and the original repo it came from is maintained, and it can be updated in MyProject as updates are committed in the source repo.

In your situation, perhaps you have a project which you want to become a part of multiple other projects, and stay current with their development. This will let you do that, as long as all the projects are maintained in their own Git repos.

share|improve this answer
Hmmm... interesting. I think I'm talking about something else, though perhaps not. I have a file folder that is NOT physically (?) within the GIT repo (not a subfolder of the folder that has the .git file), but I want its contents to be under source control. This would allow strange things such as one directory showing up in several GIT repos at once via hard links. – Dan Rosenstark Oct 5 '10 at 19:14
I see, I misunderstood what you were trying to do. I changed my answer to discuss submodules; is this more in line with what you're trying to do? – Stephen Jennings Oct 6 '10 at 4:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .