0

It seems there is some overlap in those git sub-commands:

  • describe
  • rev-parse
  • name-rev
  • symbolic-ref
  • show-ref

Is there a nice table somewhere which underlines what some of them can not do? It should cover:

  • failure indication
  • reading/writing
  • flexibility with output details
  • listing all or one
  • search around/exact
Robert Siemer
  • 32,405
  • 11
  • 84
  • 94

1 Answers1

0

If a subcommand is not listed, it can’t do that operation.

  • branch → sha1 (short)
    • git rev-parse (--short) [[refs/]heads/]branch
    • git show-ref --hash (--abbrev) [[refs/]heads/]branch
  • tag → sha1 (of the first object in a possible chain)
    • same as branch → sha1, but ...
    • use [[refs/]tags/]tag
  • tag → sha1 (of final commit object in a tag chain)
    • git rev-parse [[refs/]tags/]tag^{}
      • this is a general mechanism which works in most commands
    • git show-ref can be used with --dereference, but you still have to grep for the sha1

TBC

  • sha1 → branch
    • exact
    • search
  • sha1 → tag

    • exact
    • search
  • HEAD→branch

  • HEAD→sha1
  • HEAD-alikes→branch
  • HEAD-alikes→sha1
  • sha1→HEAD-alike
Robert Siemer
  • 32,405
  • 11
  • 84
  • 94