我怎样才能减少使用文件路径的git bisect运行? [英] How can I cut down a git bisect run using file paths?

查看:135
本文介绍了我怎样才能减少使用文件路径的git bisect运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 git bisect 找到失败导致提交。但是,范围内的许多提交肯定是不相关的(因为它们是对文档或单元测试的承诺)。我想让git bisect自动跳过影响某些目录中的文件的提交。这可能以某种方式吗?

解决方案

您有以下几种选择:


  1. 忽略特定提交

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

      git bisect跳过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 / 

    您可以将结果提供给 git bisect

      git bisect skip`git log --pretty = format:使用shell功能跳过 %H tests / docs /`


    I'm using git bisect to find a failure inducing commit. However, a lot of the commits in the range are definately irrelevant (because they are commits to the documentation or to unit tests). I'd like to make git bisect automatically skip commits which affect files in certain directories. Is this possible somehow?

    解决方案

    You have several options here:

    1. Ignoring specific commits

      git bisect contains functionality of skipping commits. You can specify commits, tags, ranges you don't want to test with

      git bisect skip 0dae5f ff049ab ...
      

      Just do this before you git bisect run, and it should skip what you specified.

    2. Specifying folders with broken sources

      You can also cut down commits bisect tests by specifying what folders it should look for problems in. This is done at the beginning of bisect process by supllying additional arguments to git bisect start (quote from standard manual):

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

      Bisect will only consider commits that touch the folders specified.


    If you want to automatically gather commits that touch certain files or folders, you may use git log for that. For example, the following command will give you commit names that modify files in certain folders:

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

    And you can supply the result to git bisect skip with use of shell capabilities:

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

    这篇关于我怎样才能减少使用文件路径的git bisect运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆