Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
187 views
in Technique[技术] by (71.8m points)

git - How can I show the hash IDs of all the commits?

This from https://stackoverflow.com/a/54314490/10082400 can show only the hash IDs of selected commits

git rev-list --ancestry-path $ahash..branch1

This can show all kinds of information about all the commits:

git log --all

How can I show only the hash IDs of all the commits? Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can use the --all option to rev-list:

> git rev-list --all
c26b9ea61d21822e965a91096111cf6b16b526cd
726602e78b21c0b7541159f58003bd36398071e7
f581634e4cc2d29d15a0dfbea5d119e10babc847
124ba39cf50af622e4f51d712095dc304d2a69fc
3ff00334516c044a1bceb90234b569412300814a
...

You can also use the --pretty flag to control exactly what git log outputs, although in this case my abbrev setting shortened the sha1's -- --no-abbrev would make it output the same as git rev-list --all:

> git log --pretty=%h --all
c26b9ea61
726602e78
f581634e4
124ba39cf
3ff003345
...

Read up the "Pretty Formats" section of git log --help or https://git-scm.com/docs/git-log for more details.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...