最初にリポジトリ作ったばかりの時に、developブランチ作った時にマージ出来なくて困るやつ

1
2
3
4
5
6
7
8
9
$ git merge master develop
To https://github.com/xxxx/xxxxx.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/xxxx/xxxxx.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

allow-unrelated-historiesを使う

無関係なヒストリを持つリポジトリをマージしようとして怒られているので、--allow-unrelated-historiesオプションをつけてマージする

1
$ git merge --allow-unrelated-histories master develop