On Tue, Jun 3, 2014 at 7:12 AM, Magnus Therning <mag...@therning.org> wrote:

> On Tue, Jun 03, 2014 at 04:24:43AM -0700, Pierre-François CLEMENT wrote:
> >
> >
> > > I want to extend git commands set on per-repository basis and
> therefore I
> > > need to have VERSIONED sort of .config file
> > >
> >
> > You can use the repository's .git/config file to set repo-specific
> > configuration, but why would you want it to be versioned in the
> > project itself? It'd force anybody who can clone the repo to have
> > the same config file.
> >
> > I guess that the closer you could get to this would be to version a,
> > say, git.config file in the project root and then replace the repo's
> > .git/config file with a symlink to it. But keep in mind that it'll
> > still require whoever can clone the repo to decide to do so, you
> > won't be able to force them -- and doing so will prevent them from
> > having their own per-repository config file.
> Something I'd be more comfortable with is making `git-config` a shell
> script containing calls to `git config --local`.  Yes, it's then a
> two-step procedure, and people might forget to perform the second
> step, but *I* am in control and a `git pull` will not silently cause
> any config changes.

I haven't even really looked into this, but if you are using Linux with the
BASH shell, you might want to look at using the "alias" command in your
~/.profile so that the command git invokes your own shell script. This is
rather easy with a line something like:

alias git="~/bin/mygit"

Now, when the BASH shell sees the git command, it actually invokes the
~/bin/mygit program (which is a shell script). I haven't looked at writing
such a script, but I think that you'd basically just check to see if the
first parameter is "config", and, if not, then invoke the normal git
program. If the first parameter is "config", then force the --local
parameter (or not, whatever you decide you need).

Of, if by chance, you actually want to directly run git without using the
alias, just enclose the git command in " marks, like:

"git" config --global ...

The plus of this is that such a modification will only affect you, not
anyone else who may be on that machine. The minus is the same. Whether it
is a plus or a minus depends on your wants: only modify git for me, or
modify git for everybody.

Wish I had the time right now to work on that script. Hopefully this is of
some help. But, like when I was in cleaning: "I don't _do_ Windows!" <grin/>

> /M
> --
> Magnus Therning                      OpenPGP: 0xAB4DFBA4
> email: mag...@therning.org   jabber: mag...@therning.org
> twitter: magthe               http://therning.org/magnus
> What gets measured, gets done.
>      -- Tom Peters

There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to