{"thread":{"id":"59151","subject":"Feature Request - GIT config - Reference value of init.defaultBranch in alias","startedAt":"2023-01-26T09:33:40Z","lastAt":"2023-01-26T16:21:05Z","messageCount":2,"participants":["Michal Aron","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"471057","messageId":"CAHoQa4-o-=pB4zPR-1SG96KB02rixQG23mFgh0H9ojWrQ_pREg@mail.gmail.com","threadId":"59151","inReplyTo":null,"subject":"Feature Request - GIT config - Reference value of init.defaultBranch in alias","fromName":"Michal Aron","fromEmail":"aronmgv@gmail.com","sentAt":"2023-01-26T09:33:20Z","receivedAt":"2023-01-26T09:33:40Z","isPatch":false,"sender":{"key":"aronmgv@gmail.com","avatar":null},"body":"Hello,\n\nI am curious why it is not possible to reference other variables in git config.\n\nUseful scenario:\n\nGlobal git config containing all useful aliases which often reference\nthe default main branch. I discovered the config variable\ninit.defaultBranch and I would like to reference it in the aliases.\n\n1) global config having init.defaultBranch = master\n2) global config having alias com = checkout [ init.defaultBranch ]\n3) local repos replacing this value e.g. to init.defaultBranch = main\n4) using this alias in local repo git com, which will checkout me to\nthe init.defaultBranch of this repository..\n\nThis would allow us to use global aliases independently on the\nrepositories.. If this has not yet been discussed I believe it is the\ntime since many repositories are being customized to the company\nteam/company culture.\n\nAppreciate and thanks, Michal\n"},{"id":"471071","messageId":"xmqqbkmlcln6.fsf@gitster.g","threadId":"59151","inReplyTo":"CAHoQa4-o-=pB4zPR-1SG96KB02rixQG23mFgh0H9ojWrQ_pREg@mail.gmail.com","subject":"Re: Feature Request - GIT config - Reference value of init.defaultBranch in alias","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-01-26T16:21:01Z","receivedAt":"2023-01-26T16:21:05Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michal Aron <aronmgv@gmail.com> writes:\n\n> 1) global config having init.defaultBranch = master\n> 2) global config having alias com = checkout [ init.defaultBranch ]\n\nI do not think it is a good idea to special case just a single\nconfiguration variable and come up with a special syntax to refer to\nit.\n\nIsn't\n\n  [alias]\n\tcom = !git checkout $(git config init.defaultBranch)\n\nsufficient?\n"}]}