我如何在git日志中查看提交的git bisect状态?

4

我正在进行git bisect,到目前为止已经找到了一些好的和坏的提交,可以通过运行git bisect log来确认。

然而,如果我运行我的分支的git log git log --graph --decorate=full origin/master..mybranch,我可以看到它显示某个提交是origin/mybranch和mybranch,另一个我当前检出的是(HEAD),但它不会用任何东西显示“好”的或“坏”的提交。

我的git版本是“git version 2.40.0.windows.1”。

这里使用了一个公开可用的git repo进行复制。

git clone https://github.com/agrimm/zombie-chaser.git
cd zombie-chaser
git bisect start
git bisect bad d27ec73cf2f1df89cbccd41494f579e066bad6fe
git bisect good 3a99fd1ee5a20aa18e5202e9a8c3ee0ba04a740e
git log --graph --decorate=full master

* commit d27ec73cf2f1df89cbccd41494f579e066bad6fe (refs/remotes/origin/master, refs/remotes/origin/HEAD, refs/heads/master)
| Date:   Mon Apr 12 23:24:20 2010 +1000
|
|     Fixed typos, updated home page URL.
|
* commit ae1c1d263168cf123578ff5d50f4fc7eb9726a52 (HEAD)
| Date:   Sun Apr 11 22:17:39 2010 +1000
|
|     Bump up to version 0.1.0.
|
* commit 2a1e2a6c7d2b7036a36c291cc220cbc486815aa8
| Date:   Sun Apr 11 19:19:27 2010 +1000
|
|     Move library files and ui files into a lib subdirectory, and other changes to file loading.
|
* commit 3a99fd1ee5a20aa18e5202e9a8c3ee0ba04a740e
| Date:   Sun Apr 11 12:28:10 2010 +1000
|
|     Removed gosu as a dependency, to satisfy jruby.


运行 git bisect log:

$ git bisect log
git bisect start
# status: waiting for both good and bad commits
# bad: [d27ec73cf2f1df89cbccd41494f579e066bad6fe] Fixed typos, updated home page URL.
git bisect bad d27ec73cf2f1df89cbccd41494f579e066bad6fe
# status: waiting for good commit(s), bad commit known
# good: [3a99fd1ee5a20aa18e5202e9a8c3ee0ba04a740e] Removed gosu as a dependency, to satisfy jruby.
git bisect good 3a99fd1ee5a20aa18e5202e9a8c3ee0ba04a740e

我期望得到的是在某些提交之后看到一些“好”的或“坏”的文本,但实际上我什么也没有得到。
1个回答

2

你需要使用其中一个 (最简单、显示所有引用) 的二分引用:

git log --decorate-refs=refs/ [other options]

或者(更长但更精确):

git log --graph --decorate=full --decorate-refs=refs/bisect \
    --decorate-refs=refs/heads --decorate-refs=refs/tags \
    --decorate-refs=refs/remotes --decorate-refs=refs/stash \
    --decorate-refs=HEAD

在这里,我列出了refs/bisect以及默认的装饰引用,以便我们不包含超过我们想要的内容。[1]

解释

--decorate=full表示引用以“完整”的方式显示,换句话说,是完整的引用路径:

# with `--decorate=short`
master
# with `--decorate=full`
refs/heads/master

“Full” doesn’t mean “all kinds of refs” (that’s at least what I thought at first).

The command git log --graph --decorate=full origin/master..mybranch doesn’t work because refs/bisect is not decorated by default. I don’t think man git-log [2] is terribly direct about documenting what the default refs are, but it is mentioned as a sort of appendix to one of the switches:

If none of these options or config settings are given, then references are used as decoration if they match HEAD, refs/heads/, refs/remotes/, refs/stash/, or refs/tags/.

Notes

  1. There is also the config option log.excludeDecoration
  2. Git 2.40.1

1
git log --oneline --graph --glob=refs/bisect/bad* --not --glob=refs/bisect/good*(或新/旧或您使用的任何术语代替坏/好)可能非常有用。 - jthill

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接