50

次のような履歴があります。

* 3830e61 Add data escaping.              (Bad)
* 0f5e148 Improve function for getting page template.
*   aaf8dc5 Merge branch 'navigation'
|\
| * 3e667f8 Add icons.
| * 43a07b1 Add menu styles.              (Breaks)
| * 107ca95 Add Responsive Nav.           (Good)
* | ea3d736 Add ‘Admin’ notice.
* | 17ca0bb Update placeholder text.
|/
* f52cc34 Add featured image.
* 2abd954 Style placeholders.

もっと学びたいと思ってgit bisectいますが、この歴史に問題があります。私はそれ107ca95が良いことと3830e61悪いことを知っています。を実行するgit bisectと、コミット107ca95..3e667f8が無視されます。43a07b1それがリグレッションを導入したコミットであることはたまたま知っていますが、評価されることはありません。

これが大まかに私がやったことです:

git checkout master
git bisect start
git bisect bad
git bisect good 107ca95
git bisect bad (multiple times)

私が何をしても、107ca95..3e667f8テストのためにチェックアウトされることはありません。

これらのコミットをテストするために、バイセクト中に履歴を本質的に「平坦化」できる方法はありますか? インタラクティブrebaseを使用して履歴を平坦化できることはわかっていますが、そうする必要はありません。

4

4 に答える 4

11

これはすでに回答済みです

基本的なアイデア - 機能ブランチからのどのコミットがマスターを壊すかを見つけるには、ea3d736 - 関連するマスター HEAD の上に再適用する必要があります。

以下は、あなたのためにそれを行うテストスクリプトの例です( git docから):

$ cat ~/test.sh
#!/bin/sh

# tweak the working tree by merging the hot-fix branch
# and then attempt a build
if  git merge --no-commit ea3d736 &&
    make
then
    # run project specific test and report its status
    ~/check_test_case.sh
    status=$?
else
    # tell the caller this is untestable
    status=125
fi

# undo the tweak to allow clean flipping to the next commit
git reset --hard

# return control
exit $status

それを実行します:

git bisect start 3830e61 f52cc34 
git bisect good ea3d736 17ca0bb #If you want to test feature branch only
git bisect run ~/test.sh
于 2014-09-05T01:49:05.203 に答える
-7

「git start」コマンドでコミットの範囲を選択できます。コマンドの概要は次のとおりです。

git bisect start <bad> <good>

あなたの特定のケースでは、正しいコマンドは次のようになると思います:

git bisect start 3830e61 107ca95
于 2013-07-01T02:20:44.763 に答える