How can I make git commit files in a symlinked folder

A workaround would be to have /srv/www/projectfiles be a symlink to /home/me/code/project/static so git sees no symlinks


If you are using linux, I particularly like the solution provided by GitBLSR. It is a library that is loaded via LD_PRELOAD that transparently dereferences symlinks to files and folders outside a repository.

To install it for a local user account is simple:

git clone https://github.com/Alcaro/GitBSLR.git
cd GitBSLR
./install.sh

This will compile the library and create an alias like the following in ~/.bashrc:

alias git="LD_PRELOAD=/path/to/gitbslr.so git"

Using this alias enables the transparent link dereferencing.


Consider using a mount point to mount the destination folder (which you presently symlink to) to appear in the location you want it beneath the git project. I've used this approach successfully.