【发布时间】:2015-11-14 06:20:54
【问题描述】:
我有这个 git 别名:
[alias]
# rebase feature branch onto current branch (typically release branch)
rebm = !sh -c 'echo rebasing branch \"$0\" on top of \"$1\" && git checkout \"$0\" && git pull origin \"$0\" && git rebase \"$1\" && git checkout \"$1\" && git merge \"$0\" && echo all done && exit 1'
最后一个命令每次都失败,如果是什么 - 例如:git status,exit 1等。每次我得到最后一个命令的“xyz:找不到命令”。
我在 OSX 上运行它。 控制台输出为:
git rebm featbranch releasebranch
... standard git output ...
featbranch: exit: command not found
fatal: While expanding alias 'rebm': 'sh -c 'echo rebasing branch "$0" on top of "$1" && git checkout "$0" && git pull origin "$0" && git rebase "$1" && git checkout "$1" && git merge "$0" && echo all done && exit 1'': No such file or directory
【问题讨论】:
-
将
-x添加到别名中,看看git实际运行了什么命令? -
不管这里的问题是什么,为了更好的可读性,您是否考虑过编写脚本而不是将所有这些命令内联到别名的定义中?