Git - how to handle symlinks

前端 未结 3 1432
情深已故
情深已故 2021-01-30 10:02

What is the correct way to handle symlinks in git?

I have the following structure:

Vendors
  Module A
  Module B
  Module C
App
 Code
   Modules
     Cor         


        
3条回答
  •  忘掉有多难
    2021-01-30 10:38

    Git stores the symlink, just like any other file in its version control - except for a symlink it would only store the information about the path it is symlinking to, and the file type as symlink instead of a regular file.

    If the symlink points to a directory, git does not store the contents under the symlinked directory.

    So there should be no harm in storing symlinks versioned under git for your case.

    One more thing you need to be aware of with symlinks is that, git would only recreate the symlinks on a fresh clone, not the file or directory it is pointing at. There are chances that the symlinked path would be non-existent (say when using absolute paths).

提交回复
热议问题