Py学习  »  Git

Git子模块在分支签出时忽略错误,因为该子模块没有该分支

QuocNg • 3 年前 • 1522 次点击  

我在git存储库中有6个子模块,子模块1,子模块2,。。。子模块6。 关于4个子模块:子模块1/2/4/5 featureABC说,我在它们上面有一个分支。

当我运行checkout命令时:

$ git submodule foreach git checkout featureABC

有一个错误:

error: pathspec 'featureABC' did not match any file(s) known to git
fatal: run_command returned non-zero status for submodule3

我知道子模块3/6没有分支功能ABC,我想在运行递归签出时忽略它们。所以我的问题是:有没有办法忽略签出错误,保持子模块3/5的分支不变,继续其他子模块的签出?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/132227
 
1522 次点击  
文章 [ 1 ]  |  最新文章 3 年前
phd
Reply   •   1 楼
phd    3 年前

忽略此shell语法的所有错误:

git submodule foreach "git checkout featureABC || :"

: 意思是“什么都不做”。