0

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?

Bo A
  • 3,144
  • 2
  • 33
  • 49
  • 1
    Which version of git are you using? I can't find the `-s` or `--all` flags in the documentation for the version I have installed or the latest version (http://git-scm.com/docs/git-show) – opqdonut Aug 14 '12 at 13:28
  • @opqdonut I'm using 1.7.11.3. Those flags are valid however, not sure why it's not in the documentation though. – Bo A Aug 14 '12 at 14:13

3 Answers3

2

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.

Michał Politowski
  • 4,288
  • 3
  • 30
  • 41
  • At first I was looking for the first case but looking at my script again, I don't need the tagged commits at all. `git show -s --pretty=format:%H --branches` worked great! – Bo A Aug 14 '12 at 14:11
0

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
amorfis
  • 15,390
  • 15
  • 77
  • 125
0

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)

Brian Phillips
  • 12,693
  • 3
  • 29
  • 26