git 子模块 foreach 不作为别名工作
git submodule foreach not working as alias
我曾经使用像
这样的命令
git submodule foreach git status
或对于可能失败的命令
git submodule foreach "git checkout develop || true"
所以现在我为第一个表单创建了一个别名并且它工作正常
git config --global alias.all '!f(){ git submodule foreach "git $@"; }; f'
然后我尝试对第二种形式也这样做,但它根本不起作用
git config --global alias.all '!f(){ git submodule foreach "git $@ || true"; }; f'
请注意,我仍然可以使用第一个
git all "checkout develop || true"
但在使用别名时,这看起来像是不必要的输入。
上面例子中使用'git all'给出的错误是
错误:pathspec 'develop || true' 与 git
已知的任何文件都不匹配
虽然在 'submodules' 中输出错误,但它会继续到下一个子模块。
关于如何修复第二个版本的任何指示?
干杯。
对我有用(几乎):
$ git config alias.all
$ git config alias.all '!f(){ git submodule foreach "git $@ || true"; }; f'
$ git config alias.all
!f(){ git submodule foreach "git $@ || true"; }; f
$ git all checkout master
Entering 'genxml'
/usr/lib/git-core/git-submodule: 342: /usr/lib/git-core/git-submodule: git checkout: not found
Stopping at 'genxml'; script returned non-zero status.
嗯,真奇怪,我希望它的工作方式与以下相同:
$ git all "checkout master"
Entering 'genxml'
error: pathspec 'master' did not match any file(s) known to git.
Entering 'third-party/c14n2'
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/cmclib'
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/eplant'
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/pycryptoserver'
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/ufod'
warning: unable to rmdir ufod/xsd: Directory not empty
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
至少按预期工作。
我曾经使用像
这样的命令git submodule foreach git status
或对于可能失败的命令
git submodule foreach "git checkout develop || true"
所以现在我为第一个表单创建了一个别名并且它工作正常
git config --global alias.all '!f(){ git submodule foreach "git $@"; }; f'
然后我尝试对第二种形式也这样做,但它根本不起作用
git config --global alias.all '!f(){ git submodule foreach "git $@ || true"; }; f'
请注意,我仍然可以使用第一个
git all "checkout develop || true"
但在使用别名时,这看起来像是不必要的输入。
上面例子中使用'git all'给出的错误是 错误:pathspec 'develop || true' 与 git
已知的任何文件都不匹配虽然在 'submodules' 中输出错误,但它会继续到下一个子模块。
关于如何修复第二个版本的任何指示?
干杯。
对我有用(几乎):
$ git config alias.all
$ git config alias.all '!f(){ git submodule foreach "git $@ || true"; }; f'
$ git config alias.all
!f(){ git submodule foreach "git $@ || true"; }; f
$ git all checkout master
Entering 'genxml'
/usr/lib/git-core/git-submodule: 342: /usr/lib/git-core/git-submodule: git checkout: not found
Stopping at 'genxml'; script returned non-zero status.
嗯,真奇怪,我希望它的工作方式与以下相同:
$ git all "checkout master"
Entering 'genxml'
error: pathspec 'master' did not match any file(s) known to git.
Entering 'third-party/c14n2'
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/cmclib'
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/eplant'
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/pycryptoserver'
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/ufod'
warning: unable to rmdir ufod/xsd: Directory not empty
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
至少按预期工作。