Search code examples
ruby-on-rails-3gitdeploymentheroku

Is there a way to delete a branch on heroku


I am using heroku to host my application. With merges and rebases i got 2 different stages of my app.

Local master is different from master on heroku.

pushing to heroku master failed with:

 ! [rejected]        master -> master (non-fast-forward) 
 error: failed to push some refs to 'git@heroku.com:xxxxx.git'             
 Merge the remote changes (e.g. 'git pull') before pushing again.  See the    
 'Note about fast-forwards' section of 'git push --help' for details.                                                                                 

is there a way to delete the heroku master? then i can push it again to heroku master..


Solution

  • You can force push

    git push --force origin master
    

    That will overwrite remote master.

    You can also delete remote branch by doing this

    git push origin :master
    

    Note the colon before branch name. This command says "take void from local machine and put this instead of remote branch 'master'"