1GH-SEARCH-COMMITS(1) GitHub CLI manual GH-SEARCH-COMMITS(1)
2
3
4
6 gh-search-commits - Search for commits
7
8
9
11 gh search commits [<query>] [flags]
12
13
14
16 Search for commits on GitHub.
17
18
19 The command supports constructing queries using the GitHub search syn‐
20 tax, using the parameter and qualifier flags, or a combination of the
21 two.
22
23
24 GitHub search syntax is documented at: https://docs.github.com/search-
25 github/searching-on-github/searching-commits
26 ⟨https://docs.github.com/search-github/searching-on-github/searching-
27 commits⟩
28
29
30
32 --author <string>
33 Filter by author
34
35
36 --author-date <date>
37 Filter based on authored date
38
39
40 --author-email <string>
41 Filter on author email
42
43
44 --author-name <string>
45 Filter on author name
46
47
48 --committer <string>
49 Filter by committer
50
51
52 --committer-date <date>
53 Filter based on committed date
54
55
56 --committer-email <string>
57 Filter on committer email
58
59
60 --committer-name <string>
61 Filter on committer name
62
63
64 --hash <string>
65 Filter by commit hash
66
67
68 -q, --jq <expression>
69 Filter JSON output using a jq expression
70
71
72 --json <fields>
73 Output JSON with the specified fields
74
75
76 -L, --limit <int>
77 Maximum number of commits to fetch
78
79
80 --merge
81 Filter on merge commits
82
83
84 --order <string>
85 Order of commits returned, ignored unless '--sort' flag is spec‐
86 ified: {asc|desc}
87
88
89 --owner <strings>
90 Filter on repository owner
91
92
93 --parent <string>
94 Filter by parent hash
95
96
97 -R, --repo <strings>
98 Filter on repository
99
100
101 --sort <string>
102 Sort fetched commits: {author-date|committer-date}
103
104
105 -t, --template <string>
106 Format JSON output using a Go template; see "gh help formatting"
107
108
109 --tree <string>
110 Filter by tree hash
111
112
113 --visibility <strings>
114 Filter based on repository visibility: {public|private|internal}
115
116
117 -w, --web
118 Open the search query in the web browser
119
120
121
123 # search commits matching set of keywords "readme" and "typo"
124 $ gh search commits readme typo
125
126 # search commits matching phrase "bug fix"
127 $ gh search commits "bug fix"
128
129 # search commits committed by user "monalisa"
130 $ gh search commits --committer=monalisa
131
132 # search commits authored by users with name "Jane Doe"
133 $ gh search commits --author-name="Jane Doe"
134
135 # search commits matching hash "8dd03144ffdc6c0d486d6b705f9c7fba871ee7c3"
136 $ gh search commits --hash=8dd03144ffdc6c0d486d6b705f9c7fba871ee7c3
137
138 # search commits authored before February 1st, 2022
139 $ gh search commits --author-date="<2022-02-01"
140
141
142
143
144
146 gh-search(1)
147
148
149
150 Oct 2023 GH-SEARCH-COMMITS(1)