Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git bisect with additional patch

Tags:

git

git-bisect

Let's say I have these revisions:

  • rev 1 introduces bug #1
  • rev 2 possibly introduces bug #2
  • rev 3 possibly introduces bug #2
  • rev 4 possibly introduces bug #2
  • rev 5 fixes bug #1

To verify where bug #2 occured, bug #1 needs to be fixed.

Can the revision where bug #2 first occured be determined during a single git bisect run, possibly through manually appling the rev 5 patch on each bisect step? Would manually patching interfere a bisect?

like image 570
silverwind Avatar asked Apr 28 '15 21:04

silverwind


People also ask

How do I remove a bad commit in git bisect?

Use Git Bisect to find the commit in which line 2 is changed from 'b = 20' to 'b = 0.00000'. Remove the bad commit by using Git Revert. Leave the commit message as is. Push to the remote repository.

How do you reset a bisect?

Bisect reset (A new git bisect start will also do that, as it cleans up the old bisection state.) For example, git bisect reset HEAD will leave you on the current bisection commit and avoid switching commits at all, while git bisect reset bisect/bad will check out the first bad revision.

How do you find a commit which broke something after a merge operation?

To track down a broken commit, git gives us a very handy tool called git bisect . Git bisect does a binary search to find the broken commit.


2 Answers

After actually reading the docs, something like this might work (per bisect step):

git cherry-pick [patch-rev]
git reset --hard
git bisect [good/bad]
like image 133
silverwind Avatar answered Sep 30 '22 20:09

silverwind


When you reach the region that requires the hot-fix patch(rev 5 in your ex.), just run:

git cherry-pick --no-commit hot-fix 

Then continue bisecting normally.

like image 39
Luke Avatar answered Sep 30 '22 20:09

Luke