How can I specify custom global gitconfig path?

前端 未结 3 1349
故里飘歌
故里飘歌 2020-12-31 16:56

I\'m in a bit of a bind with Git. I\'m trying to execute git commit but I need to be able to swtich between ~/.gitconfig1 and ~/

3条回答
  •  旧巷少年郎
    2020-12-31 17:24

    Mario Ceppi's alias approach can be used in a slightly more elegant way using the -c config=value argument to git:

    $ alias sillygit="git -c user.name=Silly -c user.email=silly@silly.org"
    $ sillygit commit
    

    This of course assumes you don't mind keeping the differing config keys in your .bashrc or the like instead of in your .gitconfig, and it has the caveat of breaking shell completion.

提交回复
热议问题