Let's consider we have a file f
somewhere on the disk: /path/to/f
Since f
is not inside my git repository (and has to remain at it's original position) I would like to create a link in my git repository, so that I do not have to manually copy changes of f
every time into the git repository.
In other words: I would like git to track the contents of f
, although f
is not located in the repository.
How can I achieve this behavior? Is it possible to force git tracking the contents of links created with ln
?
If you do
ln /path/to/f /path/to/your/repo/f
, the contents are stored fine in the repository, as you create a hard linke, meaning a second name for the same file on disk. If you change one, you change both, but for programes the files appear to be separate files but they are essentially only two pointers to the same file.