ぼくは以下のようなエラーに遭遇することがなんどかあった。
$ git push origin piyo
To https://github.com/mochizukikotaro/sample.git
! [rejected] piyo -> piyo (non-fast-forward)
error: failed to push some refs to 'https://github.com/mochizukikotaro/sample.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.
ちなみにこのようになるのは、
master->piyo => PR だしてある
master->piyo2 => あとから PR だして、先にマージする
などの流れをやったときなどです。
このときに、`(e.g. git pull ...) などと書かれてるけど
$ git fetch origin
$ git pull rebase origin/piyo
#=> conflict が GitHub 上で発生するので、以下。
$ git merge master
#=> fix conflict
$ git push origin piyo
これで、事なきを得るのですが。あっているのか...
なんか間違ってる気がする..。