Every developer on my team has their own local configuration. That configuration information is stored in a file called devtargets.rb
which is used in our rake build tasks. I don't want developers to clobber each other's devtargets file, though.
My first thought was to put that file in the .gitignore
list so that it is not committed to git.
Then I started wondering: is it possible to commit the file, but ignore changes to the file? So, I would commit a default version of the file and then when a developer changes it on their local machine, git would ignore the changes and it wouldn't show up in the list of changed files when you do a git status or git commit.
Is that possible? It would certainly be a nice feature…
Best Answer
Sure, I do exactly this from time to time using
To undo and start tracking again (if you forgot what files were untracked, see this question):
Relevant documentation:
Fail gracefully in this case means, if there are any changes upstream to that file (legitimate changes, etc.) when you do a pull, it will say:
and will refuse to merge.
At that point, you can overcome this by either reverting your local changes, here’s one way:
then pull again and re-modify your local file, or could set
–no-assume-unchanged
and you can do normal stash and merge, etc. at that point.