web学習日記

プログラミングやweb関係を学んだことを呟くブログ

Github実践入門を読みました!

f:id:nana205:20190614014256j:plain
いままで学習をしていて、githubにコードをコミットしてリポジトリにpushすることしかやっていませんでしたが、
教科書を参考に基本的なブランチの作り方やブルリクエストの仕方などがわかりました。
途中第6章のpullRequestでブランチを作ってリモートリポジトリを作成し、pushしようとしたところ、

 ! [rejected]        work -> work (non-fast-forward)
error: failed to push some refs to 'git@github.com:masa555/first-pr.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.

エラーが発生しました。
調べたところこちらの記事に原因が載っていました。
qiita.com

原因

どうやら一度remoteにpushした場所との整合性がとれずerrorがでてしまったみたいです。
下記のおりやったら無事解決できました。

git push origin :現在のブランチ名
git push origin 現在のブランチ名