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

Feature Request - GIT config - Reference value of init.defaultBranch in alias

From
MAMichal Aron <aronmgv@gmail.com>
Date
Jan 26, 2023, 09:33 UTC
Message-ID
<CAHoQa4-o-=pB4zPR-1SG96KB02rixQG23mFgh0H9ojWrQ_pREg@mail.gmail.com>
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
Next: Junio C Hamano
Message 1 of 2 in “Feature Request - GIT config - Reference value of init.defaultBranch in alias”
  1. Michal AronJan 26, 2023
  2. Junio C HamanoJan 26, 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.