Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...