プロつく計画1-3:2週目
の問題が解決したので。
問題
GitHubにpushしようとしたらこんなエラーが出た。
Pushing to https://github.com/ZeitungM/SameGameSiv3DJan2016.git To https://github.com/ZeitungM/SameGameSiv3DJan2016.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/ZeitungM/SameGameSiv3DJan2016.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にマージ、ブランチは即削除
- GitHubにpush
- 後でコードを見てみたら、ちゃんとマージされてなかったのか、ブランチでの変更がmasterに反映されていない
- 削除したブランチを復活させて修正、マージ
- pushしようとしたら上記のエラーが出る
記憶が曖昧だけど大体こんな感じ。
原因
よくわからないけどリモートとローカルで競合が起きているらしい。
対処法
- 作業用ブランチを切る
- 作業用ブランチにpull
- 作業用ブランチをmasterにマージ
これでpushできるようになりました!やったね!
メモ
- vimでペーストするにはInsキー