gavenkoa
gavenkoa

Reputation: 48753

Bisecting over gitflow style git repository with broken intermidiate commits

It is normal to have intermediate commits that failed to compile or broken in other way in feature branch in gitflow model.

Only the matter is to be stable at point of merge to develop branch where review and automatic tests applied.

Can git bisect over develop branch without hitting broken intermediate commits from feature branches?

I do not like to adapt my bisect test scrips to skip/workaround broken commits from feature development...

One way I think about solving a problem is to tell Git somehow walk only across merge changesets...

Upvotes: 2

Views: 203

Answers (1)

VonC
VonC

Reputation: 1324537

Considering the way git bisect pick the next commit to examine (through PRNG -- pseudo random number generator), you could consider making a wrapper.

That wrapper would:

  • call git bisect
  • for each commit, it would double-check if the commit has more than one-parent
  • if not, it would call git bisect skip

That way, your bisect test script remains unchanged.

A workaround is described in "How do you get git bisect to ignore merged branches?" by David Ness.

I wrote a Python script to help do this on GitHub.
If you run this script, it will try to trace backwards and follow your branch and emit a list of commit ids that are the tips of the branches that are merged into your branch.
With this list, you can give these to "git bisect good" and bisect will then omit all of the commits on the merged branches from your bisection, achieving the desired result.

That might not be exactly your case, but the idea remain: compute the list of commits you do not want, and feed them to git bisect good.

Upvotes: 1

Related Questions