[Git] Search a specific revision with git grep

Created on November 30, 2026

You can pass a revision after the search pattern to have git grep search the files from that revision. This example looks for something in the commit 100 generations back along the first-parent history from HEAD.

git grep 'something' HEAD~100

You can use a commit hash, tag, or branch name in place of HEAD~100.

Git