How to use a bash function in a git alias?

前端 未结 3 1547
醉话见心
醉话见心 2020-12-21 01:59

I want to use a bash function in a git alias. So I added this to my .bashrc:

fn() {
    echo \"Hello, world!\"
}
export -f fn

3条回答
  •  不知归路
    2020-12-21 02:39

    I don't know why, but if I just put a space before the function name in .gitconfig, it works without a problem and outputs the message:

    [alias]
        fn = ! fn
    

    It might be a bug in git, or I'm missing something in the documentation.

提交回复
热议问题