0

修正とテストを行い、git commit -aブランチを更新しました。今は、以前に作成したGitHubフォークにプッシュしようとしています。

vagrant@rails-dev-box:~/rails$ git push mine my_fix
Username for 'https://github.com': myusername
Password for 'https://myusername@github.com':
To https://github.com/myusername/rails.git
 ! [rejected]        my_fix -> my_fix (non-fast-forward)
error: failed to push some refs to 'https://github.com/myusername/rails.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.

この問題の理由は、フォークが少し古くなっているためだと思います(おそらく1週間)。負けたくないのですが、フォークに他のプッシュをしました。私はここで何をしますか?

4

3 に答える 3

1

あなたのブランチは最新ではないと思うので、最近の変更をプルしてから、変更をリモートにプッシュする必要があります。

    $git pull --rebase branch_path
    $git push remote_name branch_name
于 2012-11-24T03:53:36.487 に答える
0

あなたの(Github)フォークはアップストリームの変更について何も知りません

メッセージは明確に述べています

リモートの変更をマージする

つまり、Githubリポジトリには、ローカルリポジトリにはないチェンジセットがあります

于 2012-11-24T03:48:33.367 に答える
0

masterローカルでブランチにいる間:

  1. 上流にレール/レールを追加する必要があります。 git remote add upstream git://github.com/rails/rails.git
  2. ここで、リベースでプルします(リベースすると、rails / railsの更新に追いつくのが簡単になるため、マージではありません) git pull --rebase upstream master
  3. 変更をマスターにプッシュします(強制的にプッシュする必要がありますが、この操作の後で以前の変更を回復するのはやや困難になるため、注意して変更に問題がないことを確認してください) git push --force origin master
于 2012-11-24T09:57:56.953 に答える