"selectively" merging with git

I would like to have a git repository with a branch for development and a branch for deployment. I have several configuration files and databases that my project needs. I want the deployment branch to not have any configuration files or database files for my project, but I want to save versions of these files in my development branch in order to be able to test. Is there a way, when merging the development branch into the deployment branch, so that the merge process ignores these files?

+7
source share
3 answers

From the pro git book: http://git-scm.com/book/en/Customizing-Git-Git-Attributes#Merge-Strategies

On your branch

echo 'myconfig.cfg merge=ours' >> .gitattributes 

You can either gitignore ( man gitignore ) or save .gitattributes locally only in your branch.

+3
source

You can use git merge --no-commit and delete the configuration files before doing the merge. However, there may be more optimized features.

However, I would recommend either having files in both branches, or not having them at all. What language and development environment do you use? They provide some ability to specify different files depending on what kind of assembly you are trying to do?

+6
source

You can do pseudo merge. This would indeed be a redistribution of commits from what has not yet been merged. Therefore, if at some point you merged earlier and saved the way the two branches looked, you should only merge what the differences are commits entered after the last merge.

Here is the answer that describes this "special merge":

Always ignore specific commit when merging in git

0
source

All Articles