git svn rebase で conflict したときの解消手順

メモ。

$ git svn rebase

したときに、自動的にマージできず、

CONFLICT (content): Merge conflict in path/to/conflicted_file
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

rebase refs/remotes/trunk: command returned error: 1

こんなメッセージが出たときの解消手順。

status を確認するとこんなかんじ。

$ git status
path/to/conflicted_file: needs merge
# Not currently on any branch.
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       unmerged:   path/to/conflicted_file

現在、どの branch にもいないらしいです。

衝突を起こしたファイルは手編集で衝突を解消。

その後、git svn rebase のメッセージにしたがって git rebase --continue …したら怒られた。

$ git rebase --continue
You must edit all merge conflicts and then
mark them as resolved using git add

編集が済んだファイルは教えなきゃいけないらしい。

$ git add path/to/conflicted_file
$ git rebase --continue

これで、rebase 完了 (git svn rebase --continue ではないことに注意)。

$ git status
# On branch master
(snip)

master branch に戻って来ました。

よく分かってないので、まずいところがあったら誰か教えてください。