Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
每次运行我的项目时,我都有一个文件会受到修改。因此,我不想让 git 跟踪它,所以我将它添加到我的 .gitignore 文件中。
但是,我确实希望在克隆项目时提取文件。
我怎样才能做到这一点?
先感谢您。
不,您不能忽略文件,不能跟踪它并期望它在克隆中可用。
您可以做的是,将文件添加到存储库中,运行git update-index --assume-unchanged以便 git“忽略”对它的更改,然后您将在克隆中拥有该文件。
git update-index --assume-unchanged