stop git from tracking a file without removing the file from other developers machine

我是研究僧i 提交于 2019-12-25 01:45:14

问题


I have a file name settings.py. In my host machine settings.py has a different configuration with that of other developers. I want to stop git from tracking settings.py but not to delete this file from other developers machine when ever they pull changes in the project

Some people talk about including the file in .git/info/exclude folder. But i have no idea as where to locate this file. I searched for it in my project folder( where git has been initialize). To no avail.

expected result When ever i commit changes, all changes are push to master except my settings.py file, but not deleting this file from other developers machine when ever they pull my changes.


回答1:


You already mentioned the correct answer. You can use .git/info/exclude as also documented here. If you have not created this file yet, you can do so now. Simply place a text file called exclude in .git/info. The .git folder should be present already in the root of your repository.

The file uses the same syntax as a regular .gitignore file, but will only be applied to you.

You can also manually specify a core.excludesfile as described in this answer:

git config --global core.excludesfile ~/.gitignore


来源:https://stackoverflow.com/questions/55508425/stop-git-from-tracking-a-file-without-removing-the-file-from-other-developers-ma

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!