-->

GitHub search - how to exclude (logical NOT) compa

2020-06-16 01:26发布

问题:

In this search query (test it live ↗) I'm searching for:

  • all pull requests
  • by user limonte (me)
  • for the vaadin company

How can I search for all my pull requests except (logical NOT) those for vaadin company?


These two options I tried without success:

  • is:pr author:limonte user:!vaadin
  • is:pr author:limonte user:NOT vaadin

回答1:

Prefixing any search qualifier with a - excludes all results that are matched by that qualifier.

For example, you might be interested in finding all "cats" repositories with more than 10 stars that are not written in JavaScript:

cats stars:>10 -language:javascript

You might also want to find all issues mentioning @defunkt that are not in repositories in the GitHub organization:

mentions:defunkt -user:github

The answer for your question is:

is:pr author:limonte -user:vaadin


For more refer the GitHub Search Syntax



回答2:

It looks like you can just use the word NOT now:

hello NOT world matches repositories that have the word "hello" but not the word "world."

https://help.github.com/en/articles/understanding-the-search-syntax

I got tired of getting unit tests in my searches, so I was searching like so:

NOT test in:path AND "search-term" in:file