简体   繁体   English

如何使用提交号显示git日志?

[英]How to show git log with commit numbers?

I found an example on how to delete a commit but it includes git log in the following format 我找到了一个关于如何删除提交示例,但它包含以下格式的git log

Number  Hash    Commit Message  Author
1   2c6a45b (HEAD) Adding public method to access protected method  Tom
2   ae45fab Updates to database interface   Contractor 1
3   77b9b82 Improving database interface    Contractor 2
4   3c9093c Merged develop branch into master   Tom
5   b3d92c5 Adding new Event CMS Module Paul
6   7feddbb Adding CMS class and files  Tom
7   a809379 Adding project to Git   Tom

When I issue the git log command I'm getting log in another format and without the numbers (which are required by the task). 当我发出git log命令时,我正在以另一种格式登录并且没有数字(这是任务所需的)。

How to get git log with numbers? 如何使用数字获取git log

You could combine the nl command with git log --oneline to enumerate output lines. 您可以将nl命令与git log --oneline结合使用以枚举输出行。 It's far from ideal but if you are just looking for the line numbers: 它远非理想,但如果您只是寻找行号:

$ git log --oneline | nl
 1  91236f3 Message
 2  a611069 Message
 3  f2813e7 Message
 4  01b59e4 Message
 5  2343455 Message

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

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