简体   繁体   中英

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

I'd like to access reflog subjects with a plumbing command. I'd expect:

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

to give me what I want, but this just gives me output like:

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 ). 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 . 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 . 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 . (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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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