Question

I have a single repository that contains several sub-projects and no sub-trees or sub-modules. I now have a bug on a new feature that needs fixing in Project C. C depends on projects A and B.

For the feature to work, I need the latest version of Project A.

Somewhere in project B, the bug was introduced. So my question is:

Can I run git bisect and tell it to only operate on Project B's source tree while keeping A and C at their latest versions?

Was it helpful?

Solution

No, git bisect does not support that. You should never but different projects into the same repo. Git does not like or support that. Here’s what you can do despite that:

git bisect basically has two modes here: the normal mode and the --no-checkout mode. You can use either of both to achieve your goal in different ways:

  1. Normal: run git bisect and at every step, before you test, you put the correct version of your subprojects in the working tree with git checkout master -- sub/project/folder. You might have to undo that after testing befor you can conitnue the bisect.
  2. --no-checkout: run git bisect start --no-checkout. Now the steps won’t have any effect on your repo, apart from setting a BISECT_HEAD reference. Use this reference to check out projectB only: git checkout BISECT_HEAD path/to/projectB. Now do your test.

I would recommend the --no-checkout method. And note that while 3lectrologos’ tip did not work, it is still helpful. Giving the path of ProjectB to git bisect will allow to make use of the fact that errors could only have been introduced at revisions that contain changes to ProjectB.

OTHER TIPS

I think git bisect start -- path/to/projectB should do the trick.

Note: As pointed out in the comments below, this will not keep the rest of the repo to its most recent state, but will bisect considering only commits that made changes to the specified path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top