且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

暂时从git中删除文件

更新时间:2023-12-04 20:35:58

git update-index 应该做你想做的事

这会告诉git你想开始忽略对文件的更改

git update-index --assume-unchanged path / to / file



当你想再次开始跟踪时, $ b git update-index --no-assume-unchanged path / to / file



Github文档:更新索引


I have setup a local git on my machine. When I initialized git, I added pre-compiled libs and binaries. However, now during my development I don't want to check in those files intermittently. I dont want to remove these files from repo. Is there any way to not keep a track of these files till I complete my development. (I think I can not use .gitignore as it works only for those files which are not in git. I want to temporarily disable tracking of files.)

git update-index should do what you want

This will tell git you want to start ignoring the changes to the file
git update-index --assume-unchanged path/to/file

When you want to start keeping track again
git update-index --no-assume-unchanged path/to/file

Github Documentation: update-index