3

git .gitkeep 文件

 3 years ago
source link: https://www.jianshu.com/p/c9d1a76de45b
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
0.1732021.04.30 02:23:49字数 166阅读 32

git .gitkeep 文件

之前我在gitee创建了一个叫knowledge的项目,并且创建了一个空的php目录。

将代码克隆代码库查看,会发现在在空的php目录中会存在一个.keep文件:

www@SD-20200928IIIF:/mnt/d/data/knowledge$ ls -l
total 8
-rwxrwxrwx 1 root root  989 Apr 22 08:51 README.en.md
-rwxrwxrwx 1 root root 1353 Apr 22 08:51 README.md
drwxrwxrwx 1 root root  512 Apr 22 08:51 php
www@SD-20200928IIIF:/mnt/d/data/knowledge$ ls -a php
.  ..  .keep

有趣的事,在别的项目中也可能会出现这个文件,只不过有的名称可能是.gitkeep。它(.keep)在你想用git提交空目录时特别有用。

git默认是不允许提交一个空的目录到版本库上的, 可以在空的文件夹里面建立一个.keep或者.gitkeep文件,然后提交去即可。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK