It sounds like you should read up on git attributes. Check out the section at the bottom of this page
This is helpful if a branch in your project has diverged or is
specialized, but you want to be able to merge changes back in from it,
and you want to ignore certain files. Say you have a database settings
file called database.xml that is different in two branches, and you
want to merge in your other branch without messing up the database
file.