GitHub READ ME編集後エラー

エラー文(Git Hub上でREAD ME編集後)(かわいい絵文字をつけました)

 

git push後

To github.com:tamam03/style.git
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'github.com:tamam03/style.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

??

 

git statusしてみる

 

 git status
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

 

 

???今行ったcommitあるよ言われてる

 

https://git-scm.com/book/ja/v2/Git-%E3%81%AE%E5%9F%BA%E6%9C%AC-%E5%A4%89%E6%9B%B4%E5%86%85%E5%AE%B9%E3%81%AE%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%81%B8%E3%81%AE%E8%A8%98%E9%8C%B2

 

一旦この記事から

echo 'style' > README         からの

git status

 

On branch main
Your branch is ahead of 'origin/main' by 1 commit.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        README

 

ほう・・?

 

https://qiita.com/zenfumi/items/7425b8e9a807659137ae

 

次にこちらから

git fetch

git push origin master(今回はmain)

 

→viエディタ起動。

コマンド切り替え出来ず、

脱出できる方法でとにかくExit→commit "N"など・・・

 

最終的にgit push できるようになったが

git status時

On branch main
Your branch is up to date with 'origin/main'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        README

 

こちらが表示されるように・・・

 

 

 

 

 

Gitしっかりまとめてみます。

 

まず

①ローカルブランチ

・・・ローカルリポジトリにあるブランチ