4

I think I have seen on twitter a way to specify a commit by providing a String that is contained in its message. So with a history like this

  1. alpha <-- current head
  2. beta
  3. gamma
  4. gamut
  5. omega

git checkout <magic stuff>'gam' would checkout the commit with commit message gamma.

What was the syntax for this?

Note 1: I'm not actually sure that was for checkout, might have been for a different command, but I'm hoping for one that is universally applicable.

Note 2: It might not have been specifying a single commit but the range starting at that commit and ending at the current HEAD.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348

1 Answers1

2

Use the following form:

git checkout :/<term>

In your case it's:

git checkout :/gam

See https://stackoverflow.com/a/23303550/2067527 for more details on the various tree-ish and commit-ish forms.

mp911de
  • 17,546
  • 2
  • 55
  • 95