別の人が同じブランチにすでにプッシュしてしまった� �合、Git はあなたの変更をプッシュできません:
$ git push origin main > To https://hostname/USERNAME/REPOSITORY.git > ! [rejected] main -> main (non-fast-forward) > error: failed to push some refs to 'https://hostname/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 origin # オンラインリポジトリへの更新をフェッチする $ git merge origin YOUR_BRANCH_NAME # オンラインで行われた更新をローカル作業にマージするまたは、単純に git pull を使用して両方のコマンドを一度に実行できます:
$ git pull origin YOUR_BRANCH_NAME # オンライン更新をつかみ、ローカル作業にマージする