git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: limiting git branch --contains

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Mar 23, 2023, 20:56 UTC
Message-ID
<CAMP44s3Bxbs6gvzXT336TtXpis6BK2tzYCGhnmMWdYfLgp5zSQ@mail.gmail.com>
In-Reply-To
<ZBygZbz5E6jVNp3y@ugly>

On Thu, Mar 23, 2023 at 1:07 PM Oswald Buddenhagen <oswald.buddenhagen@gmx.de> wrote:

Show 12 quoted lines
>
> moin,
>
> git branch --contains can be a rather expensive operation in big
> repositories. as my use case is actually a rather limited search for
> commits in my local wip branches, it would be helpful to be able to
> specify exclusions for the rev-walk, say
>
>    git branch --contains deadbeef ^origin/master
>
> suggestions how this is actually already achievable efficiently are of
> course welcome as well. ^^

Because I saw no way to specify only the actual commits of my branches, I wrote a tool: git-smartlist [1]

In particular the negate_upstreams helper, which basically goes through all the branches and does topic1@{u}..topic1 topic2@{u}..topic2 etc.

[1] https://github.com/felipec/git-smartlist/blob/master/git-smartlist
-- 
Felipe Contreras
Previous: Jeff King
Message 17 of 17 in “limiting git branch --contains”
  1. Oswald BuddenhagenMar 23, 2023
  2. Junio C HamanoMar 23, 2023
  3. Oswald BuddenhagenMar 23, 2023
  4. Derrick StoleeMar 24, 2023
  5. Oswald BuddenhagenMar 24, 2023
  6. Derrick StoleeMar 24, 2023
  7. Oswald BuddenhagenMar 24, 2023
  8. Jeff KingMar 24, 2023
  9. Oswald BuddenhagenMar 24, 2023
  10. Jeff KingMar 24, 2023
  11. Oswald BuddenhagenMar 24, 2023
  12. Jeff KingMar 25, 2023
  13. Oswald BuddenhagenMar 25, 2023
  14. Jeff KingMar 24, 2023
  15. Kristofer KarlssonMay 27, 2026
  16. Jeff KingJun 8, 2026
  17. Felipe ContrerasMar 23, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.