Re: Feature Request: Support logic or shell execution to control values in .gitconfig
- From
- Greg Troxel <gdt@ir.bbn.com>
- Date
- Aug 8, 2013, 15:47 UTC
- Message-ID
- <rmieha46v6b.fsf@fnord.ir.bbn.com>
- In-Reply-To
- <vpq1u64dx63.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 11 quoted lines
> What I suggest instead is to edit/track/share template configuration > files like > > ~/.gitconfig.in > email = me@HOSTNAME@ > > and then script something like sed -e "s/@HOSTNAME@/$(hostname)/" < > ~/.gitconfig.in > ~/.gitconfig. > > You may also use the include.path functionality to share most of your > configuration, and include a small file which is different on each host.
For what it's worth, I
keep dotfiles checked in as m4 sources, which is more or less equivalent to Matthieu's suggestion of sed
don't try to keep .gitconfig under source control, but instead have a "git-config" alias that executes a lot of "git config --global" commands.
The downsides to the git-config shell function approach are:
unwanted configurations are not removed
one has to source (e.g.) .bash_aliases and then rerun git-config after updating the dotfile repo,
I suspect what's really needed is some sort of two-way macro preprocessor that can take changes in an output file an back them into the source.