{"meta":{"title":"非-fast-forwardエラーの処理","intro":"時として、Git はリモートリポジトリへの変更の際、コミットに失敗することがあります。 その場合、プッシュが拒否されます。","product":"概要","breadcrumbs":[{"href":"/ja/get-started","title":"概要"},{"href":"/ja/get-started/using-git","title":"Git の使用"},{"href":"/ja/get-started/using-git/dealing-with-non-fast-forward-errors","title":"非早送りエラー"}],"documentType":"article"},"body":"# 非-fast-forwardエラーの処理\n\n時として、Git はリモートリポジトリへの変更の際、コミットに失敗することがあります。 その場合、プッシュが拒否されます。\n\n別の人が同じブランチにすでにプッシュしてしまった場合、Git はあなたの変更をプッシュできません:\n\n```shell\n$ git push origin main\n> To https://github.com/USERNAME/REPOSITORY.git\n>  ! [rejected]        main -> main (non-fast-forward)\n> error: failed to push some refs to 'https://github.com/USERNAME/REPOSITORY.git'\n> To prevent you from losing history, non-fast-forward updates were rejected\n> Merge the remote changes (e.g. 'git pull') before pushing again. See the\n> 'Note about fast-forwards' section of 'git push --help' for details.\n```\n\nリモート ブランチで行われた変更をローカルで行った変更に[フェッチしてマージ](/ja/get-started/using-git/getting-changes-from-a-remote-repository)することで、これを修正することができます。\n\n```shell\n$ git fetch origin\n# Fetches updates made to an online repository\n$ git merge origin YOUR_BRANCH_NAME\n# Merges updates made online with your local work\n```\n\nまたは、単純に `git pull` を使って一度に両方のコマンドを実行することもできます。\n\n```shell\n$ git pull origin YOUR_BRANCH_NAME\n# Grabs online updates and merges them with your local work\n```"}