The following behaviour is wondering and annoying me:
- I have a file in my local repository.
- I push into the remote repository. (Note: I need the file in my repository!)
- Now I want to perform local edits, that shall not be pushed remotely (e.g. a configuration customizing for my local machine only).
- By using
git update-index --assume-unchanged
I tell git not to track changes to this file. - But when I do a
git checkout -f
, my local file is overwritten again.
What would be a better way to keep my local changes but not push them remotely? Or: if there is something wrong in my procedure, what should I change?
use .gitignore to intentionally specify files to ignore.
1 - add file in local (with no specific configuration)
2 - push to remote
3 - add file to .gitignore
4 - customize your local config
5 - do stuff
6 - push to remote
-> file will be ignored and stay as is on remote.