I have a config file for our debug output system that contains a bunch of example lines. I want all of the engineers to get the basic version of this file when they clone the repo.
I don't want to commit my changes to this file. I want to ignore my changes, but leave the file in the repo for everybody else.
How do I do this? If I git ignore the file then git wants me to commit my changes to .gitignore to the repo. Changing my ~/.gitignore seems to have no effect - the changes still show up in SourceTree.
BTW, I did search around and find this thread. But it doesn't seem to do what I am looking for. How to stop tracking and ignore changes to a file in Git?
If you update your index ( git update-index
) in order to instruct git that this file "hasn't changed", then your local modifications won't have to be committed:
git update-index --assume-unchanged -- yourFile
This is a local solution though: anyone else can still modify and commit changes for that same file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.