How to get git-log to display commits using relative revision syntax of git-parse-rev

末鹿安然 提交于 2020-01-05 07:37:00

问题


git show-branch displays commits using the relative revision expressions that can be parsed by git-parse-rev, for example "dev~106^2~52". How can I get the same output from git-log?


回答1:


No.

The documentation for git log (git help log) describes ways to customize the output using --pretty=tformat:..., but unfortunately there is no placeholder for git describe-style revision identifiers, nor is there a placeholder to run a shell command and use its output. Either would make it possible to do what you want. Perhaps you can suggest them to the Git developers.




回答2:


Yes?: Something like git log | git name-rev --stdin, that is, see the git name-rev man page for obtaining this format.

I had a similar question describe a commit relative to a tag in parent^/ancestor~ format which was linked back here ;-)



来源:https://stackoverflow.com/questions/6628624/how-to-get-git-log-to-display-commits-using-relative-revision-syntax-of-git-pars

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!