How to pull only one branch from remote?

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). The applications of these customers only differ by 3 config files: database.yml, aws.yml and 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. Every time I make a change on the master, I merge it with every customer branches and push them one by one to Heroku. This is quite heavy... Following suggestion of this post: http://stackoverflow.com/questions/849308/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. 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. Any idea to solve this issue? Thanks!!!

  • Answer:

    I solved the issue by using Heroku's environment variables. 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: # 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!

ndemoreau at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

I would not version control customer specific artifacts in your repository. Do a transform elsewhere and then push from there to heroku. You need an "admin" repo.

Adam Dymitruk

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.