Git and hard links

后端 未结 4 653
囚心锁ツ
囚心锁ツ 2020-11-28 04:31

Considering that Git does not recognize symbolic links that point outside of the repository, is there any problem using hard links?

Could Git break them? Can you pl

4条回答
  •  臣服心动
    2020-11-28 04:57

    Google 'git preserve hard links' and it shows that git does not know how to preserve hard link structure AFAIK, perhaps by design.

    Web projects of mine use hard links as follows:

    www/products/index.php
    www/products/dell_latitude_id577/index.php #(hard linked to above)
    www/products/dell_inspiron_id323/index.php #(hard linked again to above)
    
    me@server:www/products$ ls -l index.php
    -rwxr-xr-x 3 me me 1958 Aug 22 22:10 index.php*
    

    If I wanted to make changes to index.php I change it in one place and the hard links (product detail pages) point to the changes -- except git does not preserve this relationship during cloning and pulling on other computers.

    me@server:www$ git pull
    

    on another machine will create a new index.php for each hard link.

提交回复
热议问题