如何仅访问git子模块的分支名称?

罗斯·罗杰斯

我有一个子模块定义.gitmodules为:

[submodule "app/scripts/directives/foo"]
    path = app/scripts/directives/foo
    url = [email protected]:ross_rogers/foo.git
    branch = my_branch

有没有一种编程方式可以从包含的存储库访问此分支参数?

git submodule status 产生(没有换行符):

074d5c118eeae3bf622c6f878db96d8bf8b3bf47 \
app/scripts/directives/foo \
(heads/my_branch)

我处于Windows CMD Shell和Linux bash的双重环境中,因此我正在寻找一种my_branch无需使用unix cut/ awk/ et c即可以编程方式获取的方法

吉尔
git config submodule.app/scripts/directives/foo.branch

将为您提供当前正在使用的分支,并且

git config -f .gitmodules submodule.app/scripts/directives/foo.branch

将为您提供配置的默认值

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章