I solved this problem, which git doesn't seem to provide a good solution to, by not using git to solve it. I used a directory junction to link a new subfolder to a subfolder of the parent folder (i.e. linking a child folder to an "uncle folder"). Example in Command Prompt for Windows Vista and up:
cd CurrentFolder/
mklink /J "LinkedFolder" "../TargetFolder"
will cause LinkedFolder to point to TargetFolder (note the quotes). Example file structure I would then use:
- root/
- TargetFolder/
- CurrentFolder/
"POSIX-compliant" operating systems seem to use ln
or ln -s
for this functionality.
It works excellently (note: the following is from my own Windows 8.1 testing):
- the LinkedFolder does not exist before calling
mklink
- when you make the link, anything you do to the files in either the TargetFolder or the LinkedFolder will reflect in the other, as they are one and the same
- if you delete the link (LinkedFolder), nothing happens to the actual target folder (TargetFolder)
- if you delete the actual target folder (TargetFolder), the link will remain active (it does not get deleted); if you then try to access the link, you will simply get an error; if you recreate the actual target folder (TargetFolder) again, the link will continue to work as before!
See also:
NTFS Junction Point
NTFS Symbolic Link
Symbolic Link