git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Feature Request - GIT config - Reference value of init.defaultBranch in alias
@ 2023-01-26  9:33 Michal Aron
  2023-01-26 16:21 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Aron @ 2023-01-26  9:33 UTC (permalink / raw)
  To: git

Hello,

I am curious why it is not possible to reference other variables in git config.

Useful scenario:

Global git config containing all useful aliases which often reference
the default main branch. I discovered the config variable
init.defaultBranch and I would like to reference it in the aliases.

1) global config having init.defaultBranch = master
2) global config having alias com = checkout [ init.defaultBranch ]
3) local repos replacing this value e.g. to init.defaultBranch = main
4) using this alias in local repo git com, which will checkout me to
the init.defaultBranch of this repository..

This would allow us to use global aliases independently on the
repositories.. If this has not yet been discussed I believe it is the
time since many repositories are being customized to the company
team/company culture.

Appreciate and thanks, Michal

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Feature Request - GIT config - Reference value of init.defaultBranch in alias
  2023-01-26  9:33 Feature Request - GIT config - Reference value of init.defaultBranch in alias Michal Aron
@ 2023-01-26 16:21 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2023-01-26 16:21 UTC (permalink / raw)
  To: Michal Aron; +Cc: git

Michal Aron <aronmgv@gmail.com> writes:

> 1) global config having init.defaultBranch = master
> 2) global config having alias com = checkout [ init.defaultBranch ]

I do not think it is a good idea to special case just a single
configuration variable and come up with a special syntax to refer to
it.

Isn't

  [alias]
	com = !git checkout $(git config init.defaultBranch)

sufficient?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-26 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26  9:33 Feature Request - GIT config - Reference value of init.defaultBranch in alias Michal Aron
2023-01-26 16:21 ` Junio C Hamano

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).