2017-09-06 72 views
1

我正在尝试为git编写一个别名,它将接受分支名称并以递归方式在每个子模块中签出它。预计一些子模块可能没有这个分支,所以他们会被跳过。签出每个git子模块中的一个特定分支

我试过这个解决方案:

[alias] 
subco = "!f() { git submodule foreach 'git checkout $1 || true'; }; f" 

位它给我的错误,$ 1 - 不输入正确。

Entering 'Services/Payment' 
error: pathspec 'git' did not match any file(s) known to git. 
error: pathspec 'checkout' did not match any file(s) known to git. 
error: pathspec '$1' did not match any file(s) known to git. 
error: pathspec '||' did not match any file(s) known to git. 
error: pathspec 'true' did not match any file(s) known to git. 

我试图把1美元的报价,这并没有帮助,蚂蚁的建议?

回答

1

发现错误,输入$ 1应被引号外:

[alias] 
subco = "!f() { git submodule foreach 'git checkout '$1' || true'; }; f" 
相关问题