GitHub回购分支中的不同配置文件 [英] Different Config Files in GitHub Repo Branch

查看:179
本文介绍了GitHub回购分支中的不同配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个GitHub仓库,它有一个主分支和一个分支分支,他们都有单独的配置文件,用于部署到不同的地方。我希望当我在暂存分支上执行一个pull request给master时,我可以如何排除两个分支中我想保持不同的配置文件。



我怎样才能以最简单的方式实现这一点?一个永久性的解决方案会很好,但是从目前我读到的内容来看,它会涉及到藏匿和流行?或者可能只是在2个配置文件被覆盖后执行撤消/还原?



这对我来说并不理想,因为它会导致Travis-CI开始2个独立的编译/部署过程。



Nick。

解决方案

您可以使用我们的策略来做到这一点。在两个分支中创建一个名为 .gitattributes 的文件,并在其中添加以下内容:

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

然后提交你的 .gitattributes 文件:

  git add。 
git commit -m'新增gitattributes'


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.

解决方案

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'

这篇关于GitHub回购分支中的不同配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆