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

Is there a reason why variable expansion is not allowed in git?

From
JZJack Adrian Zappa <adrianh.bsc@gmail.com>
Date
Apr 29, 2022, 12:30 UTC
Message-ID
<CAKepmagtT6=AzP5=-AhTtR1GbAb5nXJ8h24WsqTDm5B=7CSCyg@mail.gmail.com>

I was trying to make my .gitconfig cleaner and easier to maintain, and I found that variable expansion isn't a thing. Why is that?

A use case that this would be useful is having several commands requiring the same parameters which are long and hard to read and maintain, such as a regex. You can see my question on SO here: https://stackoverflow.com/questions/72005402/is-there-a-way-to-define-and-use-a-user-defined-variable-in-the-gitconfig-file

Although an answer was submitted, it is a very roundabout way to do something that should be very simple. There is the %(var) expansion for paths available, so I would think that a similar simple text expansion wouldn't be that difficult. Perhaps by using curly braces rather than parenthesis?

Is there a place where I could request this as a feature?
Cheers,
JAZ
Message 1 of 1 in “Is there a reason why variable expansion is not allowed in git?”
  1. Jack Adrian ZappaApr 29, 2022

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.