Searching github commits
Posted by jpluimers on 2020/07/29
Finding the github commit search page was not obvious to me as the main page only allows searching for repositories, and commit pages insides repositories do not have a search box:
- [WayBack/Archive.is] main page The world’s leading software development platform · GitHub
- [WayBack/Archive.is] repository page GitHub – jpluimers/GExperts
Luckily there are two search pages that can search issues:
You can get to both by stumbling on [WayBack] About searching on GitHub – User Documentation, then clicking “Search using a visual interface”
The first search page has built-in help which I have included below, though not explaining how to search for commits which are in [WayBack] Searching commits – User Documentation, and certainly does not tell you need to add type=commits
to the search box.
Actually, there is no “visual interface” for commit search: it is a question of assembling the search URL by hand, though this trick helps a lot:
- Use GitHub · Where software is built: Advanced Search to make a similar search for a repository:
- define repository
- define phrase
- define date range
- Adopt the URL with key/value information from Searching commits – User Documentation
- Remember a base search inside a repository is like https://github.com/search?utf8=%E2%9C%93&q=repo:jpluimers%2FGExperts+search&type=commits which searches
- repository
jpluimers/GExperts
- phrase
search
type=commits
- repository
This is how I got
- from: https://github.com/search?utf8=%E2%9C%93&q=repo%3Ajpluimers%2FGExperts+created%3A2018-06-02..2018-08-05&type=Repositories&ref=advsearch&l=&l=
- to: https://github.com/search?utf8=%E2%9C%93&q=repo%3Ajpluimers%2FGExperts+committer-date%3A2018-06-02..2018-08-05&type=commits
Back to the basic search
Search cheat sheet
GitHub’s search supports a variety of different operations. Here’s a quick cheat sheet for some of the common searches.
For more information, visit our search help section.
Basic search
This search Finds repositories with… cat stars:>100 Find cat repositories with greater than 100 stars. user:defunkt Get all repositories from the user defunkt. tom location:”San Francisco, CA” Find all tom users in “San Francisco, CA”. join extension:coffee Find all instances of join in code with coffee extension. NOT cat Excludes all results containing cat.
Repository search
Repository search looks through the projects you have access to on GitHub. You can also filter the results:
This search Finds repositories with… cat stars:>100 Find cat repositories with greater than 100 stars. user:defunkt Get all repositories from the user defunkt. pugs pushed:>2013-01-28 Pugs repositories pushed to since Jan 28, 2013. node.js forks:<200 Find all node.js repositories with less than 200 forks. jquery size:1024..4089 Find jquery repositories between the sizes 1024 and 4089 kB. gitx fork:true Repository search includes forks of gitx. gitx fork:only Repository search returns only forks of gitx.
Code search
Code search looks through the files hosted on GitHub. You can also filter the results:
This search Finds repositories with… install repo:charles/privaterepo Find all instances of install in code from the repository charles/privaterepo. shogun user:heroku Find references to shogun from all public heroku repositories. join extension:coffee Find all instances of join in code with coffee extension. system size:>1000 Find all instances of system in code of file size greater than 1000kbs. examples path:/docs/ Find all examples in the path /docs/. replace fork:true Search replace in the source code of forks.
Issue search
Issue search looks through issues and pull requests on GitHub. You can also filter the results:
This search Finds issues… encoding user:heroku Encoding issues across the Heroku organization. cat is:open Find cat issues that are open. strange comments:>42 Issues with more than 42 comments. hard label:bug Hard issues labeled as a bug. author:mojombo All issues authored by mojombo. mentions:tpope All issues mentioning tpope. assignee:rtomayko All issues assigned to rtomayko. exception created:>2012-12-31 Created since the beginning of 2013. exception updated:<2013-01-01 Last updated before 2013.
User search
User search finds users with an account on GitHub. You can also filter the results:
This search Finds repositories with… fullname:”Linus Torvalds” Find users with the full name “Linus Torvalds”. tom location:”San Francisco, CA” Find all tom users in “San Francisco, CA”. chris followers:100..200 Find all chris users with followers between 100 and 200. ryan repos:>10 Find all ryan users with more than 10 repositories.
Then the commit search
Search within commit messages
You can find commits that contain particular words in the message. For example, fix typo matches commits containing the words “fix” and “typo.”
Search by author or committer
You can find commits by a particular user with the
author
orcommitter
qualifiers.
Qualifier Example author:USERNAME
author:defunkt matches commits authored by @defunkt. committer:USERNAME
committer:defunkt matches commits committed by @defunkt. The
author-name
andcommitter-name
qualifiers match commits by the name of the author or committer.
Qualifier Example author-name:NAME
author-name:wanstrath matches commits with “wanstrath” in the author name. committer-name:NAME
committer-name:wanstrath matches commits with “wanstrath” in the committer name. The
author-email
andcommitter-email
qualifiers match commits by the author’s or committer’s full email address.
Qualifier Example author-email:EMAIL
author-email:chris@github.com matches commits authored by chris@github.com. committer-email:EMAIL
committer-email:chris@github.com matches commits committed by chris@github.com. Search by authored or committed date
Use the
author-date
andcommitter-date
qualifiers to match commits authored or committed within the specified date range.Dates support greater than, less than, and range qualifiers.
Qualifier Example author-date:YYYY-MM-DD
author-date:<2016-01-01 matches commits authored before 2016-01-01. committer-date:YYYY-MM-DD
committer-date:>2016-01-01 matches commits committed after 2016-01-01. Filter merge commits
The
merge
qualifier filters merge commits.
Qualifier Example merge:true
merge:true matches merge commits. merge:false
merge:false matches non-merge commits. Search by hash
The
hash
qualifier matches commits with the specified SHA-1 hash.
Qualifier Example hash:HASH
hash:124a9a0ee1d8f1e15e833aff432fbb3b02632105 matches commits with the hash 124a9a0ee1d8f1e15e833aff432fbb3b02632105
.Search by parent
The
parent
qualifier matches commits whose parent has the specified SHA-1 hash.
Qualifier Example parent:HASH
parent:124a9a0ee1d8f1e15e833aff432fbb3b02632105 matches children of commits with the hash 124a9a0ee1d8f1e15e833aff432fbb3b02632105
.Search by tree
The
tree
qualifier matches commits with the specified SHA-1 git tree hash.
Qualifier Example tree:HASH
tree:99ca967 matches commits that refer to the tree hash 99ca967
.Search within a user’s or organization’s repositories
To search commits in all repositories owned by a certain user or organization, use the
user
ororg
qualifier. To search commits in a specific repository, use therepo
qualifier.
Qualifier Example user:USERNAME
gibberish user:defunkt matches commit messages with the word “gibberish” in repositories owned by @defunkt. org:ORGNAME
test org:github matches commit messages with the word “test” in repositories owned by @github. repo:USERNAME/REPO
language repo:defunkt/gibberish matches commit messages with the word “language” in @defunkt’s “gibberish” repository. Filter public or private repositories
The
is
qualifier matches public or private commits.
Qualifier Example is:public
is:public matches public commits. is:private
is:private matches private commits. Further reading
–jeroen
Leave a Reply