0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHubへのpushが「fetch first」と表示されてrejectedとなったときの対処

Last updated at Posted at 2021-12-23

原因

原因はリモートリポジトリーで変更した内容がローカルに反映されていないため、pushができない。

対処方法

① git fetch.    してから、
② git merge.    そして、
③ git branch.   で既存のbranchを確認してからpushをして終了。

git fetchとは

gitの場合、リポジトリはリモートとローカルで2つある。
git fetchとはリモートリポジトリで更新された最新情報をローカル
リポジトリに持ってくるコマンドのこと。
しかしpullのようにファイルが更新されるわけではない。

ファイルが更新されるのではなく、
orgin/masterが更新される。

git mergeとは

マージは、Git において分岐した履歴を戻して統合する手段です。
git merge コマンドは、 git branch を使用して作成された、独立した複数の開発ラインをひとつのブランチに統合するコマンドです。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?