使用Git的过程中,会遇到一个问题
用时间顺序讲述这个问题流程是:
github仓库中有一个空文件夹test,还有一个文件a.txt,在本地git克隆下来后,将本地的a.txt剪切到本地的空文件夹test中,再add commit push,结果查看github仓库,发现test文件夹里有a.txt,文件夹外还有a.txt
这是因为Git无法直接跟踪空目录,于是本章做一个测试
- 远程仓库创建一个空仓库
- 本地克隆远程仓库
- 本地添加资源


- 推送到远程仓库
看见没,空文件夹并没有提交成功

- 将文件剪切到空文件夹(错误操作)

- push
发现问题出现了,明明已经将文件剪切到空文件夹,push到远程仓库中发现,文件夹内外都有这个文件



- 复制文件,而不是剪切文件(正确操作)
复制后,再删除本地的文件夹外部的文件,再次push,也就是两次push,才不会出现刚才的问题