【问题标题】:How to easily run git bisect with patches on top cleanly如何轻松干净地运行带有补丁的 git bisect
【发布时间】:2021-11-18 22:52:19
【问题描述】:

我正在尝试运行 git bisect 来查找损坏的提交,但我遇到的问题是,如果没有在顶部应用额外的一系列补丁,损坏并不明显。我只是从另一个分支中挑选出那些,但我遇到的问题是,在平分的某些步骤中,它们不能干净地应用并且需要一些修复。这应该不是问题,但我在修复后似乎无法继续前进。

比如说……

$ git bisect start
djrscally@valhalla:$ git bisect bad
djrscally@valhalla:$ git bisect good tags/v5.14-rc7
Bisecting: 13382 revisions left to test after this (roughly 14 steps)
[1ea3615b6168eaaf07445c8d32a4c6bc965d9579] iio: accel: sca3000: Use sign_extend32() instead of opencoding sign extension.
djrscally@valhalla:$ git cherry-pick --no-commit 820aca592e0c^..58915847b332
Auto-merging include/acpi/acpi_bus.h
Auto-merging drivers/acpi/scan.c
Auto-merging drivers/i2c/i2c-core-acpi.c
Auto-merging drivers/regulator/Makefile
CONFLICT (content): Merge conflict in drivers/regulator/Makefile
Auto-merging drivers/regulator/Kconfig
CONFLICT (content): Merge conflict in drivers/regulator/Kconfig
error: could not apply 6a7e459bf029... regulator: Introduce tps68470-regulator driver
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'

此时我需要修复驱动程序/调节器/Makefile 和 Kconfig;在这一点上,我希望能够继续,但我不能:

djrscally@valhalla:$ git add .
djrscally@valhalla:$ git cherry-pick --continue
error: your local changes would be overwritten by cherry-pick.
hint: commit your changes or stash them to proceed.
fatal: cherry-pick failed

啊啊啊啊,我现在不确定该怎么做。 git cherry-pick --skip 似乎重置了早期精选提交的所有更改。我可以放弃--no-commit,但我不确定 bisect 将如何处理我突然放弃大量提交到它决定平分的点的事实。

我应该如何处理?

【问题讨论】:

    标签: git git-cherry-pick


    【解决方案1】:

    我的第一次尝试是,而不是反复挑选,而是一次完成整个批次:

    git diff 820aca592e0c^..58915847b332 | git apply -3
    

    然后解决冲突,这是最后一步,添加解决方案即可进行测试。

    这可能是一些手动 rerere'ing 的好地方,你这样做是通过 mkdir -p `git rev-parse --git-common-dir`/rr-cache 一次告诉 git 你正在使用 rerere 而没有自动化辅助,然后 git rerere 当你收到冲突通知时,然后修复添加分辨率后任何尚未修复的内容和git rerere

    【讨论】:

    • 是的,这绝对是完美的;谢谢!
    猜你喜欢
    • 2015-07-07
    • 2021-02-24
    • 2011-11-21
    • 1970-01-01
    • 2021-02-14
    • 1970-01-01
    • 1970-01-01
    • 2020-07-26
    • 2016-12-21
    相关资源
    最近更新 更多