git: symlink/reference to a file in an external repository

前端 未结 3 1470
借酒劲吻你
借酒劲吻你 2020-12-02 09:25

Is it possible in git to have a \"link\" to a particular file in a git repo? Like what git submodules do for folders but my question is about a particular file, not a full d

3条回答
  •  天命终不由人
    2020-12-02 09:56

    The accepted answer seems misleading since Git can handle symlinks just fine as long as the operating system used by all developers supports them.

    Git by default attempts to store symlinks instead of following them (for compactness and its generally what people want).

    When you checkout a tree containing the link, it restores the object as a symlink regardless of whether the target file system object exists or not.

    If you are on filesystem like FAT that does not support symbolic links, and your repository uses them, you can set core.symlinks configuration variable to false, and symlinks would be checked out as small plain text files that contain the link text.

    SO References:

    How does git handle symbolic links?

    Git - how to handle symlinks

    How can I get git to follow symlinks?

提交回复
热议问题