git rebaseすごい。git rebaseすごい(大事なことなのでry
モテメンになるには分散VCSを使おうということなのでGitをちょろちょろやっているようです。
中央リポジトリがsvnは際はgit-svnを使っているけど、挙動がよくわからないところがあって
そこを理解できてとても気持ちがいいので忘れないうちに書いておく。
git svn rebase失敗
git svn rebaseはリポジトリの更新を取り込むまあsvn upみたいな感じで使っているんだけど
コンクリフトが発生するといわゆる失敗したみたいな状態になる。
$ git svn rebase git svn rebase First, rewinding head to replay your work on top of it... Applying: "コミットコメント" error: patch failed: homuhomu.rb:1 error: homuhomu.rb: patch does not apply Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merged homuhomu.rb CONFLICT (content): Merge conflict in homuhomu.rb Failed to merge in the changes. Patch failed at 0001. 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/git-svn: command returned error: 1
homuhomu.rbでコンクリフトが発生したらこんなメッセージがでて失敗する
(まあ、例のごとくちゃんと対処法はエラーメッセージに書いてあるのでちゃんと読めばいいのに)
今まで混乱していた要因は、git svn rebaseに失敗したときはbranchが(no branch)になってしまうということ
masterで作業している思ったらなんか変なブランチに変わってる!!!って
まあ(no branch)が何者かは今回は置いておいて対処法
対処法
作業は(no branch)上で行う
git rebase --continue
まず、手動でコンクリフトを解消しgit addを実行して、unmerged状態のファイルをなくす。
その後git rebase --continueを実行すると綺麗に終わる。すごい
$ git rebase --continue
branchも(no branch)からmaster(masterで実行してるのだったら)などに戻っているはず
git rebase --abort
究極にわからなくなって、あーgit svn rebaseなんてやらなければよかった。
となった際にはgit rebase --abortを叩く。そうするとなんと実行前の状態に戻れるすごい。