简体   繁体   中英

How can I merge multiple Heroku 'new' branches to Heroku master?

I am trying to ensure that my Heroku master branch is up to date with my latest commit. Over time I have been pushing to Heroku, however it seems these pushes have been ended up as 'new' branches in Heroku remote, as opposed to being merged with Heroku master branch which is what I would like to have been doing. Here is what git remote show heroku returns:

* remote heroku
  Fetch URL: https://me@bitbucket.org/HB/hbapp.git
  Push  URL: https://me@bitbucket.org/HB/hbapp.git
  HEAD branch: master
  Remote branches:
    frontend                                        new (next fetch will store in remotes/heroku)
    james                                           new (next fetch 
    jes_fix_duedil_empty_address                    tracked
    master                                          tracked
  Local refs configured for 'git push':
    james  pushes to james  (fast-forwardable)
    master pushes to master (up to date)

Could you help me to achieve the following please:

  1. How can I tell the difference between each of the 'new' Heroku remote branches and the remote heroku master branch, something like git diff heroku frontend..master , but that doesn't work.
  2. How can I merge these new heroku remote branches into master branch and then delete all of these heroku remote branches so that I only have master. Note I have called; git fetch heroku jes_fix_duedil_empty_address and I can see that this set that branch from 'new' to 'tracked', but it still has not merged these changes to heroku master branch.
  3. For future how can I git push heroku master but so that the push merges to heroku master as opposed to createing a 'new' heroku remote branch which is what this seems to have been doing previously for me (ie I don;t ever want any other Heroku branches apart from Master, all branch merging to master will be done on origin and then origin master pushed to heroku master)?

git remote -v returns:

heroku  https://me@bitbucket.org/HB/hbapp.git (fetch)
heroku  https://me@bitbucket.org/HB/hbapp.git (push)
origin  https://me@bitbucket.org/HB/hbapp.git (fetch)
origin  https://me@bitbucket.org/HB/hbapp.git (push)

and git br returns:

  james
* master

and git push heroku master returns:

Everything up-to-date

when i know that it is not, in the sense that local code is not on heroku master.

Thanks for the help.

TLDR : The remote url for heroku is pointing on the bitbucket git repo.

Simply changing the url using git remote set-url heroku https://git.heroku.com/HEROKU_APP.git and pushing again on heroku should deploy the app

  1. Do it locally. When you push a random ( not master ) branch to heroku, it's not deployed and has no real utility. Let say you pushed master:dff52a15 on heroku, you commit some new stuff on master and some other stuff on another branch you'd like to deploy. You can see the diffs locally by doing a simple git diff dff52a15

    1. git push heroku :mybranch will delete mybranch on heroku, however, there is no need to do so.

    2. I think your better option is to do the required merge in a local branch then deploy this branch on heroku by doing a git push heroku local_branch:master You can delete your local_branch afterward

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM