问题
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