Re: GIT_CONFIG - what's the point?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Let me explain my scenario. I have an nfs mounted home directory. It
> is used across multiple machines. I use different colored xterms for
> each machine. But that means that the one set of colors in my one
> .gitconfig file don't work against all my screen backgrounds. I'm
> trying to find a way to tune the git colors per login. The ability to
> set colors in an environment variable (like most UNIX utils support)
> would be the easiest way to do this. Failing that, I was hoping that
> by setting GIT_CONFIG per login, I could tune the color schemes with
> different config files.
> 
> Since that is not how GIT_CONFIG is used, I have simply decided to
> squint where necessary, or open up a neutral colored xterm for the
> diff, regardless of machine.
> 
> Yes, I could probably do diffs in many other ways, but git diff at the
> command line is usually the most expedient.
> 
> Unless I wanted to define a GIT_CONFIG_OVER environment variable upon
> login, place inside it the appropriate -c<name>=<value> overrides for
> colors, and then define a bash function git as
> 
> git () {
>    $(which git) $GIT_CONFIG_OVER "$@"
>    return $?
> }
> 
> which seems silly.

Yeah, that 'return $?' at the end of the function does indeed seem
silly :)  (sorry, couldn't resist...)

You could use machine-specific config includes instead of that
GIT_CONFIG_OVER environment variable.  I.e. store machine-specific
color configuration in ~/.gitcolors.<machine> or something and define
the shell function as:

git () {
        command git -c include.path=~/.gitcolors.$HOSTNAME "$@"
}

The impact on your .bashrc would be much smaller than with the
GIT_CONFIG_OVER approach.
You could even turn this into an alias, if you want.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]