我正在尝试使用 shell 函数添加以下别名
scommit = "!f() { git submodule foreach -q --recursive 'git commit -a || :' ; git commit -am \" Update submodule \";}; f"
但是当我在 Git bash 中运行它时(在 Windows 上)
git config --local alias.scommit "!f() { git submodule foreach -q --recursive 'git commit -a || :' ; git commit -am "" Update submodule "";}; f"
我得到了输出
git config --local alias.scommit "fit fetch upstream() { git submodule foreach -q --recursive 'git commit -a || :' ; git commit -am "" Update submodule "";}; f"
当然它不起作用,因为
扩展别名“提交”失败;'fit' 不是 git 命令
我也尝试在 PowerShell 中运行它,但它显示了用法: git config [] ...</p>
当我手动将它添加到 .git/config 时,它就可以工作了。
如何使用 git bash/ 命令行 / PowerShell 添加此别名?为什么会变成fit fetch upstream()
?