git-svn リポジトリがあり、ブランチをマスターにマージしたいと考えていました。そのために、ブランチから始めて、次の手順を実行しました。
git commit -m "my commit message" # commit the changes on the branch
git checkout master # change to the branch I want to changes to be merged in
git svn rebase # update the repository
git merge --no-ff -m "my commit message" # merge the branch onto master
しかし、この段階で次のエラーが発生しました。
Auto-merging <file>
CONFLICT (content): Merge conflict in home/httpd/html/data/php/includes/Processes.inc.php
Automatic merge failed; fix conflicts and then commit the result.
次に、問題のある1つのファイルの競合を修正し(他のいくつかのファイルは正常にマージされました)、最後のコマンドを繰り返しました。
git merge --no-ff -m "my commit message" # merge the branch onto master
しかし、次のエラーが発生しました:
fatal: You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
わかりましたので、エラーメッセージが示すようにコミットを行いました。
git commit -m "my commit message"
その後、調べてみるgit log
と、指定されたコミット メッセージが出力に 2 回表示されていました。
最後のコミットには変更が含まれていませんが、すべての変更 (競合のあるファイルを含む) は最後から 2 番目のコミットの一部です。
3 つの質問があります。
- 同一のコミットメッセージで2つの同一のコミットを作成するために、上記で正確に何が起こったのですか?
- それを安全に修正する「簡単な」方法はありますか?(
git reset HEAD~1
最後の空のコミットを取り除くために a を実行できますか?) - マージ後に競合が発生した場合の「標準的な」手順/コマンドのリストは何ですか?
git merge
その後、git commit
または何か他のことを行う必要がありますか?
不明な点がある場合は、コメントを提供してください。質問を更新してより明確にすることができます。