prevent git from overriding tracked ignored files during a pull
So there is a file that is already tracked by git call it file.php…This is in a collaborative environment
I made changes to that file that I don’t want to have it committed but I want the changes to stay in my local environment so I did this
1. git update-index --assume-unchanged file.php 2. Added file.php to gitignore
And the changes to the file won’t get committed, etc, which is working fine
The problem is…whenever I do a
git pull origin master, the pull always attempts to override that file
I tried doing
git rm --cached file.php but that will untrack the file and requires a commit and I don’t want to affect the central repository when ignoring this..
How do I get git to ignore a tracked file during a pull?
One Solution collect form web for “prevent git from overriding tracked ignored files during a pull”
gup script is made for you: it stashes your changes, pull, and pops your changes, so you will be able to update your repository without git shouting at you.
There’s also the
git-up script that is more clever, but Windows support looks incomplete at this time.