Windows symlinks: do they play well with Git projects?

I’ve gotten good use out of GitHub for my text adventure projects in Inform 7. But one thing I’ve been doing is running a preflight script. The critical files are all in different directories, due to how Inform creates projects, and I want to pull them into a flat Github directory for simplicity’s sake.

This has worked okay, and it even allowed me to throw in pre-commit scripts before I understood hooks. But copying the files over continually is getting a bit old, and I’d like to delete this middleman.

So I am wondering if there is any reason why I should not use symbolic links, or if using too many has any risks I might not be aware of. E.g. before, the copy scripts ran

copy c:\games\inform\proj.inform\Source\story.ni c:\users\andrew\documents\github\proj\story.ni

copy c:\games\inform\proj.inform\uuid.txt c:\users\andrew\documents\github\proj\uuid.txt

copy c:\games\inform\proj materials\Cover.jpg c:\users\andrew\documents\github\proj\Cover.jpg

copy c:\games\inform\maps\mygames\proj.trizbort c:\users\andrew\documents\github\proj\proj.trizbort

copy c:\writing\invisiclues\proj.txt c:\users\andrew\documents\github\proj\proj.txt

copy c:\writing\invisiclues\proj.htm c:\users\andrew\documents\github\proj\proj.htm

And now I’d like to make links with

mklink c:\games\inform\proj.inform\Source\story.ni c:\users\andrew\documents\github\proj\story.ni

mklink c:\games\inform\proj.inform\uuid.txt c:\users\andrew\documents\github\proj\uuid.txt

mklink c:\games\inform\proj materials\Cover.jpg c:\users\andrew\documents\github\proj\Cover.jpg

mklink c:\games\inform\maps\mygames\proj.trizbort c:\users\andrew\documents\github\proj\proj.trizbort

mklink c:\writing\invisiclues\proj.txt c:\users\andrew\documents\github\proj\proj.txt

mklink c:\writing\invisiclues\proj.htm c:\users\andrew\documents\github\proj\proj.htm

Or maybe there is a solution I am not aware of that would work really well for reorganizing directories?

I have a lot of projects I want to do this for, so I wanted to make sure I wasn’t doing really wrong before making these changes. I’ve seen cases where Git works better with unix than Windows, and I wanted to check off. Thanks!

To my understanding, Git works fine with mkllink in the way that you’re describing because the true file is in the Git repository and the link is somewhere else. One of the awesome things about Git is that you can experiment on a branch to make sure everything works the way you want and only merge the changes to master when you’re confident things are working.

I hope that helps!

1 Like

It does. I forgot I posted this question, but when needing to know it became unavoidable … your answer was right here.

So, very belated thanks! Just asking this question helped me try and go ask others. I have many, many more reasons this will be useful now than seven months ago.

1 Like