Question

When using this command:

$ git show -s --pretty=format:%H --all

it prints this:

41b253549d86db3432743c1c8a9f75511779073c
83cfbe4b5a128ab06733fdde24f67171a1cf945c

20c18bee751e681856ee4587bb513400b472f941
ba73e741f3ccf7b719a67436cf8b953a1bdeeb89

tag 1.0
Tagger: <snip>


129cba44e34066bfee7ad19a278ead94c2edece9
tag 1.0.1
Tagger: <snip>


6fcdc763265454e602b746e4d81942a1f0597f2e
tag 1.0.2
Tagger: <snip>


36e56a8bc0d568661fa61cdb0a4e4c69c4c30efb
tag 1.0beta1
Tagger: <snip>

I only want commit hashes to be printed, not tag names and taggers. What should I do to fix this?

Was it helpful?

Solution

I'm not sure if you want to list the tagged commits but omit the tag info or do not want the tagged commits included at all.

If it is the first case then git rev-list --all --no-walk should do what you want.

For the second case git rev-list --branches --no-walk, or even git show -s --pretty=format:%H --branches will do.

OTHER TIPS

If you know your first commit hash, let's assume it's e562b3, you can do this:

git show -s --pretty=format:%H e562b3..HEAD

Did you try using git log --pretty=format:%H --all instead of using git show?

You don't really say what your goal is but you might even want to just use git rev-list --all.

(I can't reproduce the behavior you're seeing even on a repo that has tags but perhaps using git log or git rev-list will do the trick)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top