問題解決 branch の収束

とりあえず不具合は解決したので commit を纏めました。詳細は以下。
とりあえず、失敗したらアレなので作業用の branch を作りました。

$ git checkout -b problem-fix

で、rebase -i します。指定する commit は対象となってる一番古い commit の一つ前。

$ git rebase -i 490c6a

で、EDITOR なソレが起動して以下のようなナニが出てきます。

pick 2d878d7 temp commit
pick 92af49d temp commit
pick 236f840 temp commit
pick 190ca6f temp commit
pick bda2e96 temp commit
pick 65a28c4 temp commit
pick b1fdcb8 temp commit
pick fa38657 temp commit
pick 19f100d temp commit

# Rebase 490c6aa..19f100d onto 490c6aa
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

これらを全部纏めるのであれば二行目以降は全部 s(quash) にします。

pick 2d878d7 temp commit
s 92af49d temp commit
s 236f840 temp commit
s 190ca6f temp commit
s bda2e96 temp commit
s 65a28c4 temp commit
s b1fdcb8 temp commit
s fa38657 temp commit
s 19f100d temp commit

で、エディタを終了すると今度は commit メセジを入力するために EDITOR が再度起動してメセジ入力して終了すれば纏め完了、ですね。
あとは master 方面に merge して完了、なのかどうか。

つうか

なんとなく似た風なエントリ入れてる気がしてならない。

今回

作業てきに master から作業用の branch を作って云々してる最中に不具合が検出されたので、さらにそこから branch して問題解決してました。ただ、作業用の branch では commit を一つも作っていなかったので master == 作業用 branch という状態になってしまっていたので最終的に不具合対応 branch から直接 master に merge をしたのですが、本来ならもうワンクッション必要だったはず。
手順としては以下な形になるのかどうか。

  • master から作業用の branch を作って修正の盛り込み
  • いくつか commit 作成
  • 途中で不具合発生したので対処用の branch を作成して問題処理
  • 問題解決したら rebase する用の branch を作る
  • その branch において rebase -i で問題処理な commit を纏める
  • 作業用の branch に merge
  • 作業用の branch を merge する許可が出たら master に merge

こうやって見てみるに Github Flow てレビュとか merge の手間というかハードルがはるかに低いですね。rebase はできんけど。
ちなみに今回、上の commit log 見たら分かるようにかなりヤッツケな状態だったので、やっぱこれを rebase で纏めることができる、というのは Git の一つのアレな機能ですね。すばらです。