初めて"git push -f origin master"した。
gitへのForceとかいう不吉なことをした。
rustのコマンドを書き始めたので、gitへfirst commitしようと思った。
エラー
gitのリモートのmasterブランチが先端にないので、ローカルのほうがブランチの先にあることになり、マージできないということらしい。よくわからない。
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.
解決策
普通はこれをすればいいらしい。
git pull origin master git push origin master
しかし
なんかよくわからないがmergeを拒否された。
git pull origin master From https://github.com/psato/tree-cd * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories
今回の解決策
gitにforceした。
git push -f origin master
感想
今回は最初のコミットだったので、壊れる内容もなかったからforceした。 しかし、重要なプロジェクトで起きたらどうしようか。。。