第一次推送到远程仓库的配置文件,之后因项目每个成员的系统环境不同,配置的内容也不同,需要忽略它以防止推送
现在通过git rm --cached filename
取消跟踪,然后把文件写入.gitignore
中忽略,的确是能够忽略,但是提交的时候显示的变动是忽略的文件被删除
,并且推送到远程仓库后被忽略的文件果然被删除了
总的来说就是想第一次推送把文件推送上去, 以后就都不推送, 但没想到忽略的话是直接从仓库删除, 请各位指点下有何方法能实现?
天蓬老师2017-05-02 09:47:29
Using sparse checkoutsparse-checkout
Solved the problem
Attached reference link link description
PHP中文网2017-05-02 09:47:29
You can try to deceive yourself and pretend you can’t see it. .
git update-index --assume-unchanged xxx/xxx
PHPz2017-05-02 09:47:29
In this case, you usually create one config.ini.dist
for users to modify
伊谢尔伦2017-05-02 09:47:29
I think you don’t actually need to set ignore files in the .gitignore file. Since you don't want to push those files to the remote, but want to keep those files remotely, you can just not add them to the temporary storage area. Specifically, just git add
的时候,别把那些文件add
just go in. However, this also has the disadvantage that you may encounter a situation where you cannot switch branches because there are always some modifications that have not been added to the staging area.
滿天的星座2017-05-02 09:47:29
Your idea is very strange. Since you don’t need to worry about it after the first submission, then you don’t need to add it to the .gitignore file. Is your file constantly changing?
世界只因有你2017-05-02 09:47:29
Just add the file name directly to gitignore, and then generate one online and you’re done. Why do you have to fix git? Didn't understand.
黄舟2017-05-02 09:47:29
I have encountered this problem and haven’t found a solution yet. I guess there’s no way