1

Gitでの複数のコミットの作成者とコミッターの名前と電子メールの変更から、コミット内の電子メールを変更する方法を見てきました。ただし、プッシュしようとすると、次のエラーが発生します。

$ git push production master
To git@<remote_server>
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@<remote_server>
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.

そこで、リモートリポジトリでcommit-email-changing-commandを実行しようとすると、表示されますYou need to run this command from the toplevel of the working tree.

4

1 に答える 1

2

あなたがする必要があるgit push --forceのは、リモートリポジトリのブランチを上書きするために使用することです。

他の人がリモートリポジトリの現在のコンテンツに基づいて長期的なブランチを持っている場合、これは悪い考えであることに注意してください。その場合、履歴を変更しないでください。

ただし、破棄されて頻繁に再生成され、アップストリームブランチにマージされない短期間のブランチ(毎日自動的に再生成され、自動テストにのみ使用されるlinux-nextなど)は、まったく問題ありません。

于 2011-01-17T21:49:07.287 に答える