0

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.

john
  • 61
  • 4
  • Possible duplicate of [How to tell git to ignore all further edit to a single file without removing it from the repo](https://stackoverflow.com/questions/4114163/how-to-tell-git-to-ignore-all-further-edit-to-a-single-file-without-removing-it) – muru Apr 04 '19 at 05:26
  • Git `assume-unchanged` might be helpful here, [read this](http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html). – Tim Biegeleisen Apr 04 '19 at 05:35

1 Answers1

0

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
muru
  • 4,723
  • 1
  • 34
  • 78
Thomas Kainrad
  • 2,542
  • 21
  • 26