gpt4 book ai didi

git - 如何使用文件路径减少 git bisect 运行?

转载 作者:IT王子 更新时间:2023-10-29 01:19:14 25 4
gpt4 key购买 nike

我正在使用 git bisect找到一个失败诱导提交。然而,该范围内的许多提交肯定是不相关的(因为它们是对文档或单元测试的提交)。我想让 git bisect 自动跳过影响某些目录中文件的提交。这有可能吗?

最佳答案

这里有几个选项:

  1. 忽略特定的提交

    git bisect 包含跳过提交的功能。您可以指定您不想测试的提交、标签、范围

     git bisect skip 0dae5f ff049ab ...

    只需在 git bisect run 之前执行此操作,它应该会跳过您指定的内容。

  2. 指定包含损坏源的文件夹

    您还可以通过指定应该在哪些文件夹中查找问题来减少提交 bisect 测试。这是在 bisect 过程开始时通过向git bisect start(引自标准手册):

     git bisect start -- arch/i386 include/asm-i386

    Bisect 只会考虑涉及指定文件夹的提交。


如果你想自动收集涉及特定文件或文件夹的提交,你可以使用 git log。例如,以下命令将为您提供修改特定文件夹中文件的提交名称:

git log --pretty=format:%H  tests/ docs/

并且您可以使用 shell 功能将结果提供给 git bisect skip:

git bisect skip `git log --pretty=format:%H  tests/ docs/`

关于git - 如何使用文件路径减少 git bisect 运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3179498/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com