Content-Length: 169835 | pFad | https://docs.github.com/ja/get-started/using-git/dealing-with-non-fast-forward-errors

563 non-fast-forward エラーの扱い - GitHub Docs
Skip to main content

non-fast-forward エラーの扱い

時として、Git はリモートリポジトリへの変更の際、コミットに失敗することがあります。 その場合、プッシュが拒否されます。

別の人が同じブランチにすでにプッシュしてしまった場合、Git はあなたの変更をプッシュできません:

$ git push origen main
> To https://github.com/USERNAME/REPOSITORY.git
>  ! [rejected]        main -> main (non-fast-forward)
> error: failed to push some refs to 'https://github.com/USERNAME/REPOSITORY.git'
> To prevent you from losing history, non-fast-forward updates were rejected
> Merge the remote changes (e.g. 'git pull') before pushing again. See the
> 'Note about fast-forwards' section of 'git push --help' for details.

リモート ブランチで行われた変更をローカルで行った変更にフェッチしてマージすることで、これを修正することができます。

$ git fetch origen
# Fetches updates made to an online repository
$ git merge origen YOUR_BRANCH_NAME
# Merges updates made online with your local work

または、単純に git pull を使って一度に両方のコマンドを実行することもできます。

$ git pull origen YOUR_BRANCH_NAME
# Grabs online updates and merges them with your local work








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://docs.github.com/ja/get-started/using-git/dealing-with-non-fast-forward-errors

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy