Say you have a develop branch and a master branch (master corresponding to production). In the develop branch you might have a test folder, a scripts folder that you want to version control.
But every time you merge the develop branch with new changes to the master branch, you want to ignore scripts and tests, because master branch has exactly the same files that are in production (so that you could even automatically deploy the master branch in every merge).
What's the best way to achieve that? There should be a way to merge everything but some 'ignored' folders.
My question is a bit the same as this one. But I am surprised that is a not very popular question. I think this is a problem every developer that wants to be able to deploy automatically and is testing code will have to face