0

I have a project managed by git, deployed on Heroku. I'd want to have a 'test' version, deployed on heroku-test, and a 'prod' version, deployed on heroku-prod.

What's the best practice to do this?

  1. Have 2 different branches, push just one

    Push 'test' to heroku-test, and 'prod' to heroku-prod. I should merge them when I want to replicate updates from test to prod. In this case, I should remember each time a merge, to set properly the .env variable 'environment' to 'test' or 'prod' ;

  2. Have just one master branch,

    push the whole repo to heroku-master and heroku-test, but each server will use a different branch ('test' or 'prod') as master

DeLac
  • 1,068
  • 13
  • 43
  • You talk about a .env file? Are you using that? Would this be the only difference between the two branches? If this is the case, the .env file is not supposed to be in the git. It should be in the gitignore file and only live in your environments – Hammerbot Jan 12 '18 at 10:08
  • Having two different branches for different environments is always a good idea. Not sure how Heroku handles that, though. And as El_Matella already wrote, you should not have environment-specific configuration in your repository. Heroku can inject those configuration properties for you. – str Jan 12 '18 at 10:09
  • I'm using the .env file, yes. But it's not the only difference. – DeLac Jan 12 '18 at 10:31
  • Ideally, there should not be a difference at all. – str Jan 12 '18 at 10:39

0 Answers0