We have a config file in the repo which all the users contribute to based on their function. For my local testing, I need to manually change two values in that config file, but I never want my changes committed back to the server.
I do however want to pull updates to the file if there's a newer version in the repo, even if that means my local changes will be overwritten. That's fine, I can just make them again from a stash I created specifically to do exactly that.
What I'm wondering is if I can tell Git "Hey... I will never push back my local changes to the server, so don't show it to me as changed, but if you have new changes for me, lemme have them when I pull!"
Here's an example of what I'm after.
Server: VersionA
Local: [Nothing]
(I do a Git Pull)
Server: VersionA
Local: VersionA
(I make local changes)
Server: VersionA
Local: VersionA (Modified)
(What I want...)
Server: VersionA
Local: VersionA (Modified, but ignored locally by Git)
(Someone checks in an update to the file)
Server: VersionB
Local: VersionA (Modified, but local changes ignored by Git)
(I do a git Pull)
Server: VersionB
Local: VersionB (This overwrites my local, modified VersionA)
(I then manually update VersionB with my stashed changes)
Server: VersionB
Local: VersionB (modified, but local changes ignored by Git)
The .gitignore
file doesn't apply here because that stops new files from being added, but again, this file has already been added. I just want it to always ignore my local changes, as if they weren't there. I only care if the file has changed on the server.
So can Git be configured to do this?