简体   繁体   English

使用 git rev-list(或任何其他管道命令)访问 reflog 主题

[英]Access reflog subject with git rev-list (or any other plumbing command)

I'd like to access reflog subjects with a plumbing command.我想使用管道命令访问 reflog 主题。 I'd expect:我希望:

$ git rev-list --format='%gs' --walk-reflogs HEAD

to give me what I want, but this just gives me output like:给我我想要的,但这只是给了我 output 之类的:

commit f1cb402488661fb3662ad876e98fcce991677333
commit 65e9bd51169e7f54f76edc9dbc926ec92af2fd7f
commit 1139b67c36f878a0e82e1dad141404ed7fb0923a
commit bea98a6a32477ad8e93929ac8d8f2ec66a9d3375
commit 9682247a229f2954820887212b7769a2a89ccd45
commit a73583bb74fd4d6db7bed6a6b61ba17be812e842
commit 96dbe20f02c58f6f5599495978e962a0ee285ce8
commit aba4a324c3f95ebebf8f3c8b2db3c89660a25ebe
commit 1139b67c36f878a0e82e1dad141404ed7fb0923a
commit f35aedc3594f9cb9dce5c89638d80e19c5f257b9

OTOH:奥托:

git reflog --format='%gs' HEAD 

gives me what I'd expect.给了我我所期望的。

git reflog is a front end to git log (not to git rev-list ). git refloggit log的前端(不是git rev-list )。 While git rev-list is both a plumbing command, and a sister command to git log , it's not quite the equivalent of a plumbing version of git log .虽然git rev-list既是一个管道命令,也是git log的姊妹命令,但它并不完全等同git log的管道版本。 In particular—just as you found—it has no nice way to access and format parts of commits.特别是——正如你所发现的——它没有很好的方法来访问和格式化部分提交。

The rather sad state of affairs is that there is no plumbing version of git log .相当可悲的 state是没有git log的管道版本 Perhaps, like git status has --porcelain to turn it into plumbing, git log needs --porcelain , so that we don't need to run git -c log.decorate=... log.pretty=... to override anything that might be in some user's .gitconfig .也许,像git status--porcelain把它变成管道, git log需要--porcelain ,这样我们就不需要运行git -c log.decorate=... log.pretty=...某些用户的.gitconfig中可能存在的任何内容。 (This is not meant to say that just the decorate and pretty settings need overriding: those were just the two I could think of off-hand here. Oh, of course, pager as well.) (这并不是说只有装饰和漂亮的设置需要覆盖:这只是我在这里能想到的两个。哦,当然,寻呼机也是如此。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM