Checkout the first commit in history containing the given string

I think I saw on twitter a way to specify a commit by providing the string contained in its message. So, with such a story

  • alpha <- current head
  • beta
  • gamma
  • gamma
  • omega

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

What was the syntax for this?

Note 1. In fact, I am not sure what it was for checkout, perhaps for another team, but I hope for universal applicability.

Note 2: Perhaps he didn’t specify any commits, but a range starting with this commit and ending in the current HEAD.

+4
source share
1 answer

Use the following form:

git checkout :/<term>

In your case, this is:

git checkout :/gam

. fooobar.com/questions/12567/... .

+2

Source: https://habr.com/ru/post/1678876/


All Articles