Ignoring symlinks in git
Asked Answered
L

1

13

Is there a way to make git completely ignore symlinks (leave them in the tree, but not create them on checkout)? Alternatively, is there a way to make git convert between symlinks on linux and shortcuts on windows?

Context: I'm using git with some LaTeX files on both windows and linux. On linux, I have a large number of style files stored outside the repo, and symlinked to from a bunch of places. It'll work fine if git turns them into shortcuts on windows (I have the same surrounding directory/file structure), or if git ignores them completely, and doesn't check them out (I have the style files in my LaTeX distribution on windows).

Lampblack answered 4/3, 2011 at 5:47 Comment(1)
possible duplicate of Ignore symbolic links in .gitignoreGrassofparnassus
C
6

On the "ignoring symlink" side, you could set the config core.symlinks configuration variable to false (as a local config within the Windows Git repo):

Symlinks would be checked out as small plain text files that contain the path of the file system object that it links to, but without creating said target object.

Cambogia answered 4/3, 2011 at 6:49 Comment(6)
If I'm ignoring symlinks, then I want the files by that name to not appear. Having small text files by the name of the symlink breaks LaTeXing.Lampblack
@Jason: then I can only see a post-checkout hook moving all those files out of the way, plusupdating the index to "assume-ignore" them (in order to not detect the fact they are missing): #4634181Cambogia
Do post-checkout hooks get called on, e.g., git reset --hard?Lampblack
@Jason: don't sure, but I don't think so (#3639842)Cambogia
Even worse, I have a similar problem, but I might have symlinks with the same name in repos on two different computers, but pointing to different places. A post-checkout hook won't work with that setup, will it?Armory
@Armory it could help if the goal of that post-checkout hook is just to get rid of those symlink files.Cambogia

© 2022 - 2024 — McMap. All rights reserved.