* git log alias with --all and --exclude @ 2024-09-04 9:06 Rene Kita 2024-09-04 16:49 ` Johannes Sixt 0 siblings, 1 reply; 6+ messages in thread From: Rene Kita @ 2024-09-04 9:06 UTC (permalink / raw) To: git 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. May I ask to change that behavior and allow to put the --exclude at the end of the alias? Rene ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log alias with --all and --exclude 2024-09-04 9:06 git log alias with --all and --exclude Rene Kita @ 2024-09-04 16:49 ` Johannes Sixt 2024-09-04 18:08 ` Rene Kita 0 siblings, 1 reply; 6+ messages in thread From: Johannes Sixt @ 2024-09-04 16:49 UTC (permalink / raw) To: Rene Kita; +Cc: git 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. -- Hannes ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log alias with --all and --exclude 2024-09-04 16:49 ` Johannes Sixt @ 2024-09-04 18:08 ` Rene Kita 2024-09-04 19:58 ` Jacob Keller 0 siblings, 1 reply; 6+ messages in thread From: Rene Kita @ 2024-09-04 18:08 UTC (permalink / raw) To: Johannes Sixt; +Cc: git 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. > -- Hannes > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log alias with --all and --exclude 2024-09-04 18:08 ` Rene Kita @ 2024-09-04 19:58 ` Jacob Keller 2024-09-04 20:45 ` Junio C Hamano 0 siblings, 1 reply; 6+ messages in thread From: Jacob Keller @ 2024-09-04 19:58 UTC (permalink / raw) To: Rene Kita; +Cc: Johannes Sixt, git On Wed, Sep 4, 2024 at 11:15 AM Rene Kita <mail@rkta.de> wrote: > > 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log alias with --all and --exclude 2024-09-04 19:58 ` Jacob Keller @ 2024-09-04 20:45 ` Junio C Hamano 2024-09-05 5:23 ` Rene Kita 0 siblings, 1 reply; 6+ messages in thread From: Junio C Hamano @ 2024-09-04 20:45 UTC (permalink / raw) To: Jacob Keller; +Cc: Rene Kita, Johannes Sixt, git Jacob Keller <jacob.keller@gmail.com> writes: >> > > 'gr = log --oneline --abbrev-commit --all --graph --decorate --color' > > 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. True. If I were doing this, I would at least do something like [alias] rg = "!sh -c 'git log --oneline --abbrev-commit --graph \ --decorate --color ${1-\"--all\"} \"$@\"' -" so that (1) "git rg" without any argument will default to "--all" (2) "git rg --exclude 'wip*' --branches" would work as expected, just like "git rg --first-parent master..seen" would. Thanks. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log alias with --all and --exclude 2024-09-04 20:45 ` Junio C Hamano @ 2024-09-05 5:23 ` Rene Kita 0 siblings, 0 replies; 6+ messages in thread From: Rene Kita @ 2024-09-05 5:23 UTC (permalink / raw) To: git; +Cc: Jacob Keller, Johannes Sixt, Junio C Hamano On Wed, Sep 04, 2024 at 01:45:50PM -0700, Junio C Hamano wrote: > Jacob Keller <jacob.keller@gmail.com> writes: > > >> > > 'gr = log --oneline --abbrev-commit --all --graph --decorate --color' > > > > 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. > > True. If I were doing this, I would at least do something like > > [alias] > rg = "!sh -c 'git log --oneline --abbrev-commit --graph \ > --decorate --color ${1-\"--all\"} \"$@\"' -" > > so that > > (1) "git rg" without any argument will default to "--all" > (2) "git rg --exclude 'wip*' --branches" would work as expected, > just like "git rg --first-parent master..seen" would. > > Thanks. Thanks for the ideas, I will adjust my alias. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-09-05 5:29 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-09-04 9:06 git log alias with --all and --exclude Rene Kita 2024-09-04 16:49 ` Johannes Sixt 2024-09-04 18:08 ` Rene Kita 2024-09-04 19:58 ` Jacob Keller 2024-09-04 20:45 ` Junio C Hamano 2024-09-05 5:23 ` Rene Kita
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).