tags:

views:

329

answers:

1

Somebody already asked how you can get git to follow symlinks. There was an answer for a symlinked directory, but not for a symlinked file. It was also over a year ago.

Question: how do you get git to follow a symlink and add the file it refers to?

Here is the old question: http://stackoverflow.com/questions/86402/how-can-i-get-git-to-follow-symlinks. There's also a question about what git typically does http://stackoverflow.com/questions/954560/what-does-git-do-to-files-that-are-a-symbolic-link. I'm after a way of changing this behaviour.

In case you care: I'm running git 1.5.4.3 on unix and git version 1.6.0 on mac.

+5  A: 

I'm pretty sure there's no way.

Additionally, it sounds like a kind of insecure, undefined behavior - what should it do when you move between versions of the file and it needs to write to it? In particular, if you check out a revision before it was added, do you really want it to remove the contents of a file outside the repository? What happens if you come back to present and recreate the file, or if the symlink itself is modified - should git also track the symlink itself?

Things along these lines were said on the git mailing list late last year in response to essentially the same question.

Jefromi
these are some excellent points - thanks.
Peter
Yeah, unfortunately. I know it'd be really nice to follow links in some cases. There was an approach suggested in one of the replies there - make the outside-the-repo files symlinks into the repo, and possibly still include symlinks to them from within the repo. Hope you find a way to do what you need to!
Jefromi