今回は自分がpushしようとした時、すでに誰かがリモートリポジトリにpush指定し待っていた場合どうしたら良いのかまとめます。
今回はリモートにpushしようとしたら以下のようなエラーが出ました。
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.
誰かがpushしていて自分のリポジトリが後ろにいるよ、とのことですね。
では解決します。
解決方法
今の自分は簡単にすると、こんな感じです↓

すでにpushされてるよ!!ってなわけです。
なので、もう一度git pullしてリモートリポジトリから取得しましょう。
git pull origin {対象の自分のリポジトリ}
これでOK!
そしてpushやり直したらOK
git push origin {編集したリポジトリ}
そうすると以下のようになる↓

大体こんなイメージで大丈夫かな、と。
まとめ
gitはチーム開発でも必要となるので触る必要大大大!