Stop overwriting specific code when merging git branches?
I am currently building a webapp that I will deploy to Heroku. My webapp references it’s own data through an API.
For local development, I am referring to the api as such:
'http://localhost:3000/mywebapp/' + id + '/json'
For Heroku, I will have to do something like:
'http://mywebapp.herokuapp.com/' + id + '/json'
I have two git branches, say ‘master’ and ‘dev’. ‘Master’ gets deployed to Heroku and receives final changes that are merged from ‘dev’. My issue is having to constantly change my API code from my localhost to the heroku url.
Is there a way I can “lock in” the heroku URL in the master branch, so when I merge my local testing changes, it doesn’t get overwritten?
One Solution collect form web for “Stop overwriting specific code when merging git branches?”
A good way to handle this would be through environment variables. You can set the Heroku variable via the command line and then in code set the variables for your development environment.
here’s one way to accomplish it – http://tammersaleh.com/posts/managing-heroku-environment-variables-for-local-development