Bit中来自Git别名的错误变量名称

时间:2015-05-01 09:18:39

标签: git bash git-alias

我的全局git配置中有以下Git别名。

pushnew = !f() { export tmp_branch=`git branch | grep '* ' | tr -d '* '` && git push --set-upstream origin $tmp_branch; unset $tmp_branch; }; f

运行时,我得到以下输出:

 * [new branch]      bug/graphs -> bug/graphs
Branch bug/graphs set up to track remote branch bug/graphs from origin.
f() { export tmp_branch=`git branch | grep '* ' | tr -d '* '` && git push --set-upstream origin $tmp_branch; unset $tmp_branch; }; f: 1: unset: bug/graphs: bad variable name

我已经看到了question,但如果这是解决方案,那么如何在Git别名的上下文中应用修复?

1 个答案:

答案 0 :(得分:4)

应该是:

Blog

如果您尝试取消设置unset tmp_branch ,则shell会替换$tmp_branch的值,尝试取消设置$tmp_branch