Git bisect with merged commits

后端 未结 4 706
走了就别回头了
走了就别回头了 2021-02-02 06:17

I have a history that looks like this:

* 3830e61 Add data escaping.              (Bad)
* 0f5e148 Improve function for getting page template.
*   aaf8dc5 Merge br         


        
4条回答
  •  梦谈多话
    2021-02-02 06:58

    This is already answered

    Basic idea - to find which commit from feature-branch breaks your master, you will have to reapply it on top of ea3d736 - relevant master HEAD.

    Following is an example (from git doc)of test script which does that for you:

    $ 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
    

    Run it:

    git bisect start 3830e61 f52cc34 
    git bisect good ea3d736 17ca0bb #If you want to test feature branch only
    git bisect run ~/test.sh
    

提交回复
热议问题