How does Git handle symbolic links?

后端 未结 3 847
鱼传尺愫
鱼传尺愫 2020-11-22 03:20

If I have a file or directory that is a symbolic link and I commit it to a Git repository, what happens to it?

I would assume that it leaves it as a symbolic link un

3条回答
  •  滥情空心
    2020-11-22 03:52

    "Editor's" note: This post may contain outdated information. Please see comments and this question regarding changes in Git since 1.6.1.

    Symlinked directories:

    It's important to note what happens when there is a directory which is a soft link. Any Git pull with an update removes the link and makes it a normal directory. This is what I learnt hard way. Some insights here and here.

    Example

    Before

     ls -l
     lrwxrwxrwx 1 admin adm   29 Sep 30 15:28 src/somedir -> /mnt/somedir
    

    git add/commit/push

    It remains the same
    

    After git pull AND some updates found

     drwxrwsr-x 2 admin adm 4096 Oct  2 05:54 src/somedir
    

提交回复
热议问题