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

Re: git log alias with --all and --exclude

From
Jacob Keller <jacob.keller@gmail.com>
Date
Sep 4, 2024, 19:58 UTC
Message-ID
<CA+P7+xo9DnTitgVjHzpW1ODwRdFruDf+g+isg5pSHT8f27ASvg@mail.gmail.com>
In-Reply-To
<20240904180826.GB15670@t480>
On Wed, Sep 4, 2024 at 11:15 AM Rene Kita <mail@rkta.de> wrote:
Show 26 quoted lines
>
> On Wed, Sep 04, 2024 at 06:49:12PM +0200, Johannes Sixt wrote:
> > Am 04.09.24 um 11:06 schrieb Rene Kita:
> > > I have an alias
> > > 'gr = log --oneline --abbrev-commit --all --graph --decorate --color'
> > > and I would like to be able to sometimes exclude a branch, so call it
> > > with:
> > > $ git gr --exclude=pattern
> > >
> > > This does not work, though. Also does not work without the alias and
> > > typing the complete command by hand. Apparently the --exclude must be
> > > put before the --all to take effect.
> >
> > That is very much by design, so that you can express "branches except
> > the wip and preview branches and remotes except those from the remote
> > archive" with
> >
> > --exclude=wip/* --exclude=preview* --branches --exclude=archive/* --remotes
> >
> > These collective branch options --branches, --remotes, and --all clear
> > the exclude patterns after having them applied. Therefore, in this example,
> > the first two --exclude do not affect --remotes.
>
> OK, certainly not the answer I hoped for, but something I still
> expected. Thanks for the explanation.
>

You could implement this as a shell alias so that your options get included before the --all. I'm not sure how trivial that would be to do, but thats how I would go about implementing this alias.

Previous: Rene KitaNext: Junio C Hamano
Message 4 of 6 in “git log alias with --all and --exclude”
  1. Rene KitaSep 4, 2024
  2. Johannes SixtSep 4, 2024
  3. Rene KitaSep 4, 2024
  4. Jacob KellerSep 4, 2024
  5. Junio C HamanoSep 4, 2024
  6. Rene KitaSep 5, 2024

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.