多命令 Git 别名无效
Multi-Command Git Alias not working
我正在尝试设置一个 git 别名,以便在我提交代码之前基本上处理烦人的步骤。
我希望别名在 origin/develop 上进行提取,将 origin/develop 合并到我当前的分支,然后推送我当前的分支
我有的是:
git config --global alias.latestPush "fetch origin/develop; git merge origin/develop && git push
每次我尝试设置和 运行 这个别名时,我都会遇到一些错误。我做错了什么?
您在 git-config
documentation 中遗漏了这一点:
If the alias expansion is prefixed with an exclamation point, it will be
treated as a shell command.
如果没有 !
,别名参数将作为参数传递给 git
命令(它不知道如何处理由 ;
分隔的多个命令)。
我正在尝试设置一个 git 别名,以便在我提交代码之前基本上处理烦人的步骤。
我希望别名在 origin/develop 上进行提取,将 origin/develop 合并到我当前的分支,然后推送我当前的分支
我有的是:
git config --global alias.latestPush "fetch origin/develop; git merge origin/develop && git push
每次我尝试设置和 运行 这个别名时,我都会遇到一些错误。我做错了什么?
您在 git-config
documentation 中遗漏了这一点:
If the alias expansion is prefixed with an exclamation point, it will be treated as a shell command.
如果没有 !
,别名参数将作为参数传递给 git
命令(它不知道如何处理由 ;
分隔的多个命令)。