# Reference A Commit Via Commit Message Pattern Matching

Generally when referencing a commit, you'll use the SHA or a portion of the SHA. For example with `git-show`:

```
$ git show cd6a63d014
...
```

There are many ways to reference commits though. One way is via regex pattern matching on the commit message. For instance, if you recently had a commit with a typo and you had included *typo* in the commit message, then you could reference that commit like so:

```
$ git show :/typo
Author: Josh Branchaud
Date: Mon Dec 21 15:50:20 2015 -0600

    Fix a typo in the documentation
...
```

By using `:/` followed by some text, git will attempt to find the most recent commit whose commit message matches the text. As I alluded to, regex can be used in the text.

See `$ man gitrevisions` for more details and other ways to reference commits.

[Source](https://twitter.com/jamesfublo/status/678906346335428608)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ploegert.gitbook.io/til/tools/git/reference-a-commit-via-commit-message-pattern-matching.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
