In git, how do you exempt certain files when pulling from an upstream origin (i.e. the original project)?
I have a project that I'm working on that was originally forked from a repository that is very active. I've added the original as a remote named "upstream" so that it's possible to run:
git pull upstream
and update the project to the most recent commit.
The problem: there are some files (e.g. my Gruntfile.js
) that I do not want to update alongside the original project. Whenever I pulled these commits, I would get merge conflicts because I've changed the files in my own version.
I do want to track these files for my own local commits and pull changes from my own origin, so adding these to .gitignore
permanently isn't an option.
My current solution is to have a grunt task temporarily add Gruntfile.js
and others to .gitignore
, pull from upstream, and then remove them from .gitignore
so that I can track my own changes and push to my origin. However, this feels hacky.
Is there any way I can ignore these files only when pulling from "upstream"?