Different Config Files in GitHub Repo Branch

一个人想着一个人 提交于 2019-12-20 03:23:16

问题


So I have a GitHub repo with a master branch and a staging branch, they both have separate config files for deploying to different places. I was hoping that when I perform a pull request on the staging branch back to master, that I could some how exclude the 2 config files that I want to remain different in both branches.

How can I achieve this in the easiest way? A permanent solution would be great, but from what I've read so far it would involve doing a "stash" and a "pop"? Or maybe just performing an "undo" / "revert" after the 2 config files are overwritten?

This isn't ideal for me as it will cause Travis-CI to kick off 2 separate compilation / deployment processes.

Nick.


回答1:


You can do this using the ours strategy. Create a file named .gitattributes in your both branches and add the following content in it:

path/to/your/config.json merge=ours

Then commit your the .gitattributes files:

git add .
git commit -m 'Added gitattributes'


来源:https://stackoverflow.com/questions/32965402/different-config-files-in-github-repo-branch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!