{"thread":{"id":"62056","subject":"git log alias with --all and --exclude","startedAt":"2024-09-04T09:15:34Z","lastAt":"2024-09-05T05:29:42Z","messageCount":6,"participants":["Rene Kita","Johannes Sixt","Jacob Keller","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"502106","messageId":"20240904090614.GZ15670@t480","threadId":"62056","inReplyTo":null,"subject":"git log alias with --all and --exclude","fromName":"Rene Kita","fromEmail":"mail@rkta.de","sentAt":"2024-09-04T09:06:14Z","receivedAt":"2024-09-04T09:15:34Z","isPatch":false,"sender":{"key":"mail@rkta.de","avatar":null},"body":"I have an alias\n'gr = log --oneline --abbrev-commit --all --graph --decorate --color'\nand I would like to be able to sometimes exclude a branch, so call it\nwith:\n$ git gr --exclude=pattern\n\nThis does not work, though. Also does not work without the alias and\ntyping the complete command by hand. Apparently the --exclude must be\nput before the --all to take effect.\n\nMay I ask to change that behavior and allow to put the --exclude at the\nend of the alias?\n\nRene\n"},{"id":"502154","messageId":"0e0fb1c3-d4f7-413b-9985-d71cb1c300df@kdbg.org","threadId":"62056","inReplyTo":"20240904090614.GZ15670@t480","subject":"Re: git log alias with --all and --exclude","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2024-09-04T16:49:12Z","receivedAt":"2024-09-04T16:49:24Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 04.09.24 um 11:06 schrieb Rene Kita:\n> I have an alias\n> 'gr = log --oneline --abbrev-commit --all --graph --decorate --color'\n> and I would like to be able to sometimes exclude a branch, so call it\n> with:\n> $ git gr --exclude=pattern\n> \n> This does not work, though. Also does not work without the alias and\n> typing the complete command by hand. Apparently the --exclude must be\n> put before the --all to take effect.\n\nThat is very much by design, so that you can express \"branches except\nthe wip and preview branches and remotes except those from the remote\narchive\" with\n\n--exclude=wip/* --exclude=preview* --branches --exclude=archive/* --remotes\n\nThese collective branch options --branches, --remotes, and --all clear\nthe exclude patterns after having them applied. Therefore, in this example,\nthe first two --exclude do not affect --remotes.\n\n-- Hannes\n\n"},{"id":"502160","messageId":"20240904180826.GB15670@t480","threadId":"62056","inReplyTo":"0e0fb1c3-d4f7-413b-9985-d71cb1c300df@kdbg.org","subject":"Re: git log alias with --all and --exclude","fromName":"Rene Kita","fromEmail":"mail@rkta.de","sentAt":"2024-09-04T18:08:26Z","receivedAt":"2024-09-04T18:14:57Z","isPatch":false,"sender":{"key":"mail@rkta.de","avatar":null},"body":"On Wed, Sep 04, 2024 at 06:49:12PM +0200, Johannes Sixt wrote:\n> Am 04.09.24 um 11:06 schrieb Rene Kita:\n> > I have an alias\n> > 'gr = log --oneline --abbrev-commit --all --graph --decorate --color'\n> > and I would like to be able to sometimes exclude a branch, so call it\n> > with:\n> > $ git gr --exclude=pattern\n> > \n> > This does not work, though. Also does not work without the alias and\n> > typing the complete command by hand. Apparently the --exclude must be\n> > put before the --all to take effect.\n> \n> That is very much by design, so that you can express \"branches except\n> the wip and preview branches and remotes except those from the remote\n> archive\" with\n> \n> --exclude=wip/* --exclude=preview* --branches --exclude=archive/* --remotes\n> \n> These collective branch options --branches, --remotes, and --all clear\n> the exclude patterns after having them applied. Therefore, in this example,\n> the first two --exclude do not affect --remotes.\n\nOK, certainly not the answer I hoped for, but something I still\nexpected. Thanks for the explanation.\n\n> -- Hannes\n> \n"},{"id":"502169","messageId":"CA+P7+xo9DnTitgVjHzpW1ODwRdFruDf+g+isg5pSHT8f27ASvg@mail.gmail.com","threadId":"62056","inReplyTo":"20240904180826.GB15670@t480","subject":"Re: git log alias with --all and --exclude","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2024-09-04T19:58:34Z","receivedAt":"2024-09-04T19:58:46Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Wed, Sep 4, 2024 at 11:15 AM Rene Kita <mail@rkta.de> wrote:\n>\n> On Wed, Sep 04, 2024 at 06:49:12PM +0200, Johannes Sixt wrote:\n> > Am 04.09.24 um 11:06 schrieb Rene Kita:\n> > > I have an alias\n> > > 'gr = log --oneline --abbrev-commit --all --graph --decorate --color'\n> > > and I would like to be able to sometimes exclude a branch, so call it\n> > > with:\n> > > $ git gr --exclude=pattern\n> > >\n> > > This does not work, though. Also does not work without the alias and\n> > > typing the complete command by hand. Apparently the --exclude must be\n> > > put before the --all to take effect.\n> >\n> > That is very much by design, so that you can express \"branches except\n> > the wip and preview branches and remotes except those from the remote\n> > archive\" with\n> >\n> > --exclude=wip/* --exclude=preview* --branches --exclude=archive/* --remotes\n> >\n> > These collective branch options --branches, --remotes, and --all clear\n> > the exclude patterns after having them applied. Therefore, in this example,\n> > the first two --exclude do not affect --remotes.\n>\n> OK, certainly not the answer I hoped for, but something I still\n> expected. Thanks for the explanation.\n>\n\nYou could implement this as a shell alias so that your options get\nincluded before the --all. I'm not sure how trivial that would be to\ndo, but thats how I would go about implementing this alias.\n"},{"id":"502172","messageId":"xmqqjzfr87wh.fsf@gitster.g","threadId":"62056","inReplyTo":"CA+P7+xo9DnTitgVjHzpW1ODwRdFruDf+g+isg5pSHT8f27ASvg@mail.gmail.com","subject":"Re: git log alias with --all and --exclude","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-09-04T20:45:50Z","receivedAt":"2024-09-04T20:45:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jacob Keller <jacob.keller@gmail.com> writes:\n\n>> > > 'gr = log --oneline --abbrev-commit --all --graph --decorate --color'\n>\n> You could implement this as a shell alias so that your options get\n> included before the --all. I'm not sure how trivial that would be to\n> do, but thats how I would go about implementing this alias.\n\nTrue.  If I were doing this, I would at least do something like\n\n    [alias]\n\trg = \"!sh -c 'git log --oneline --abbrev-commit --graph \\\n\t\t--decorate --color ${1-\\\"--all\\\"} \\\"$@\\\"' -\"\n\nso that\n\n (1) \"git rg\" without any argument will default to \"--all\"\n (2) \"git rg --exclude 'wip*' --branches\" would work as expected,\n     just like \"git rg --first-parent master..seen\" would.\n\nThanks.\n"},{"id":"502193","messageId":"20240905052310.GC15670@t480","threadId":"62056","inReplyTo":"xmqqjzfr87wh.fsf@gitster.g","subject":"Re: git log alias with --all and --exclude","fromName":"Rene Kita","fromEmail":"mail@rkta.de","sentAt":"2024-09-05T05:23:10Z","receivedAt":"2024-09-05T05:29:42Z","isPatch":false,"sender":{"key":"mail@rkta.de","avatar":null},"body":"On Wed, Sep 04, 2024 at 01:45:50PM -0700, Junio C Hamano wrote:\n> Jacob Keller <jacob.keller@gmail.com> writes:\n> \n> >> > > 'gr = log --oneline --abbrev-commit --all --graph --decorate --color'\n> >\n> > You could implement this as a shell alias so that your options get\n> > included before the --all. I'm not sure how trivial that would be to\n> > do, but thats how I would go about implementing this alias.\n> \n> True.  If I were doing this, I would at least do something like\n> \n>     [alias]\n> \trg = \"!sh -c 'git log --oneline --abbrev-commit --graph \\\n> \t\t--decorate --color ${1-\\\"--all\\\"} \\\"$@\\\"' -\"\n> \n> so that\n> \n>  (1) \"git rg\" without any argument will default to \"--all\"\n>  (2) \"git rg --exclude 'wip*' --branches\" would work as expected,\n>      just like \"git rg --first-parent master..seen\" would.\n> \n> Thanks.\n\nThanks for the ideas, I will adjust my alias.\n"}]}