Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> writes: > 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.
Attachment:
pgpKLthu4gaoi.pgp
Description: PGP signature