LoginSignup
0
0

More than 1 year has passed since last update.

master以外からHerokuにpushした後、masterからHerokuへpushできない

Posted at

直前に行った手順と遭遇したエラー

  1. master以外のブランチ(issue1)からHerokuにpush
  2. masterからHerokuにpush
  3. 下記のエラーが発生
% git push heroku master               
To https://git.heroku.com/rails-portfolio-tyranno22.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/rails-portfolio-tyranno22.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.

これが原因と見られる

Note about fast-forwards

エラー解決までの流れ

こちらの記事が「fast-forwards」についての理解を深めてくれました
図で分かるgit-mergeの--ff, --no-ff, --squashの違い
つまり、デプロイ先のコミットの歴史(issue1)にmasterのコミット歴史が含まれていないからというのが本題でした。

$ git checkout master
$ git merge issue1
$ git push heroku master

問題なくpushできました

参考にした記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0