table of contents
GH-SEARCH-COMMITS(1) | GitHub CLI manual | GH-SEARCH-COMMITS(1) |
NAME¶
gh-search-commits - Search for commits
SYNOPSIS¶
gh search commits [<query>] [flags]
DESCRIPTION¶
Search for commits on GitHub.
The command supports constructing queries using the GitHub search syntax, using the parameter and qualifier flags, or a combination of the two.
GitHub search syntax is documented at:
⟨https://docs.github.com/search-github/searching-on-github/searching-commits⟩
OPTIONS¶
- Filter by author
- Filter based on authored date
- Filter on author email
- Filter on author name
- --committer <string>
- Filter by committer
- --committer-date <date>
- Filter based on committed date
- --committer-email <string>
- Filter on committer email
- --committer-name <string>
- Filter on committer name
- --hash <string>
- Filter by commit hash
- -q, --jq <expression>
- Filter JSON output using a jq expression
- --json <fields>
- Output JSON with the specified fields
- -L, --limit <int> (default 30)
- Maximum number of commits to fetch
- --merge
- Filter on merge commits
- --order <string> (default "desc")
- Order of commits returned, ignored unless '--sort' flag is specified: {asc|desc}
- --owner <strings>
- Filter on repository owner
- --parent <string>
- Filter by parent hash
- -R, --repo <strings>
- Filter on repository
- --sort <string> (default "best-match")
- Sort fetched commits: {author-date|committer-date}
- -t, --template <string>
- Format JSON output using a Go template; see "gh help formatting"
- --tree <string>
- Filter by tree hash
- --visibility <strings>
- Filter based on repository visibility: {public|private|internal}
- -w, --web
- Open the search query in the web browser
JSON FIELDS¶
author, commit, committer, id, parents, repository, sha, url
EXIT CODES¶
0: Successful execution
1: Error
2: Command canceled
4: Authentication required
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.
EXAMPLE¶
# search commits matching set of keywords "readme" and "typo" $ gh search commits readme typo # search commits matching phrase "bug fix" $ gh search commits "bug fix" # search commits committed by user "monalisa" $ gh search commits --committer=monalisa # search commits authored by users with name "Jane Doe" $ gh search commits --author-name="Jane Doe" # search commits matching hash "8dd03144ffdc6c0d486d6b705f9c7fba871ee7c3" $ gh search commits --hash=8dd03144ffdc6c0d486d6b705f9c7fba871ee7c3 # search commits authored before February 1st, 2022 $ gh search commits --author-date="<2022-02-01"
SEE ALSO¶
Dec 2024 | GitHub CLI v2.63.2 |