[英]git one local branch synchronizing with multiple remote branches: how to?
I have one application that I sold to multiple clients. 我有一个应用程序卖给了多个客户。 Each client has his own dedicated application (on Heroku). 每个客户都有自己专用的应用程序(在Heroku上)。
The applications of these customers only differ by 3 config files: database.yml, aws.yml and corporate.rb 这些客户的应用程序仅相差3个配置文件:database.yml,aws.yml和Corporate.rb
Locally, I have one master branch and as many other local branches as I have customers. 在本地,我有一个主分支机构,在其他本地分支机构中则有客户。 I need these local branches to store the 3 config files of each customer. 我需要这些本地分支来存储每个客户的3个配置文件。 Every time I make a change on the master, I merge it with every customer branches and push them one by one to Heroku. 每次对主服务器进行更改时,我都会将其与每个客户分支合并,并将其逐一推送到Heroku。
This is quite heavy... 这很重...
Following suggestion of this post: pull/push from multiple remote locations , I created one remote grouped branch and hacked my config file so that this branch is associated to multiple urls. 按照这篇文章的建议: 从多个远程位置拉/推 ,我创建了一个远程分组分支,并入侵了我的配置文件,以便该分支与多个url相关联。
The problem is that when I try to push it, It refuses to do it because the remotes are not correctly synchronized. 问题是,当我尝试推动它时,它拒绝这样做,因为遥控器未正确同步。 If I force the push, it overwrites my config files, which is not a solution either. 如果我强行推送,它将覆盖我的配置文件,这也不是解决方案。
I tried to include these config files in .gitignore, but it keeps pushing them. 我试图将这些配置文件包含在.gitignore中,但它会不断推送它们。
Any idea to solve this issue? 有解决这个问题的主意吗? Thanks!!! 谢谢!!!
I solved the issue by using Heroku's environment variables. 我通过使用Heroku的环境变量解决了这个问题。 Actually, I don't have to set any variable to use them. 实际上,我不必设置任何变量即可使用它们。 I just use the APP_NAME variable and set my config for each app in an initializer file: 我只使用APP_NAME变量,并在初始化文件中为每个应用设置我的配置:
# Custom values
case ENV['APP_NAME']
when 'pgp'
CORPORATE_NAME = 'PGP Development'
S3_BUCKET = 'pgpdevelopment'
when 'anchor'
CORPORATE_NAME = 'Anchor Group'
S3_BUCKET = 'anchorgroup'
when 'corionl'
CORPORATE_NAME = 'Corio NL'
when 'masterproj'
CORPORATE_NAME = 'Corporate Demo'
when 'adg'
CORPORATE_NAME = 'ADG'
end
#Default values
CORPORATE_NAME ||= ENV['APP_NAME']
DEPARTMENT_SELECTION ||= false
GEOSCOPE_SELECTION ||= false
GEOSCOPE_DEFAULT ||= 'world'
DEPARTMENT_DEFAULT ||= 'all'
S3_BUCKET ||= ENV['APP_NAME']
S3_CREDENTIALS = {
:access_key_id => my_key_id,
:secret_access_key => my_access_key
}
if Rails.env == "production"
S3_CREDENTIALS[:bucket] = S3_BUCKET
else
S3_CREDENTIALS[:bucket] = "#{S3_BUCKET}_dev"
end
Thx for putting me on the right track! 谢谢,让我走上正轨!
I would not version control customer specific artifacts in your repository. 我不会版本控制您存储库中特定于客户的工件。 Do a transform elsewhere and then push from there to heroku. 在其他地方进行转换,然后从那里推送到heroku。 You need an "admin" repo. 您需要一个“管理员”仓库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.