[RUBY] How to resolve errors when doing git push heroku master

【Overview】

1. Conclusion </ b>

2. What kind of error is it? </ B>

3. Why does the error occur? </ B>

4. How to solve it </ b>

  1. Conclusion

Press Compare to Blanch on the top left menu of github to marge to master </ b>!

  1. What kind of error

Terminal


%  git push heroku master
To https://git.heroku.com/*****.git
 ![rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/*****.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I got an error like this. An error that was rejected when trying to push from the local repository (master) to master to heroku. There is a hint, but I couldn't solve it at all, and I couldn't find a solution even if I looked it up.


  1. Why the error occurs

The cause was that the branches in the master and local repositories were not reflected and there was a discrepancy.

  1. How to solve

So when I pressed Compare to Blanch on the top left menu of github and marged to master, the error was resolved successfully.

❶ When you open the git hub desktop, the menu bar will appear on the upper left of the Mac. Then press "Branch". スクリーンショット 2020-09-07 21.47.57.png

❷ Then press Compare to Blanch. スクリーンショット 2020-09-07 21.48.06.png

❸ Then go back to the github desktop screen and look at the history.

❹ I think it is "1 (1 or more) ⬇︎", so integrate it into master. スクリーンショット 2020-09-07 21.48.35.png It was 0⬇︎ in the photo, but it was 1⬇︎ when the error occurred. The proof is 1⬆︎ next to it. Then I tried "git push heroku master" again in the terminal and it worked.

So I thought back on various things. I described the environment variable in javascript on Pay.jp so that the program is intentionally changed and loaded when pushing to heroku. When I made the changes, I felt like I made a branch. After all, I made a brunch, not because of my mind.


Recommended Posts