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:

  • How to show log with HEAD index
  • Git stash pop wants to merge
  • Sharing custom code between two NodeJS microservices
  • How to colorize git push output
  • Using Github GUI for Mac and git from the terminal
  • Git pull.rebase this is a possibly dangerous operation
  • 'http://localhost:3000/mywebapp/' + id + '/json'

    For Heroku, I will have to do something like:

    '' + 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?

  • Git vs Mercurial vs SVN
  • How does GitHub checks if two branches can be auto-merged?
  • Using Git or SVN with a web server
  • git clone results in: “fatal: The remote end hung up unexpectedly”
  • Gitignore: add a file that is in an excluded folder
  • git checkout refs/heads/master detaches HEAD
  • 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 –

    Git Baby is a git and github fan, let's start git clone.