简体   繁体   English

如何在gitpython中使用git子模块foreach的变量

[英]How to use variables of git submodule foreach in gitpython

Using gitpython , I would like to use repo.git.submodule('foreach', …) and get the variables available such as name , sm_path , displaypath , sha1 and toplevel as defined in the git documentation . 使用gitpython ,我想用repo.git.submodule('foreach', …)并获取可用,如变量namesm_pathdisplaypathsha1toplevel的定义git的文档

I couldn't find any documentation on gitpython and my understanding of the API is limited. 我找不到有关gitpython的任何文档,并且我对API的理解受到限制。

Thanks to stsewd reply on Github issue, one should write 感谢对Github问题的stsewd 回复 ,一个人应该写

repo = git.Repo('foo/bar')
for sub in repo.submodules:
    pass

and the documentation: https://gitpython.readthedocs.io/en/stable/reference.html#git.repo.base.Repo.submodules 和文档: https : //gitpython.readthedocs.io/en/stable/reference.html#git.repo.base.Repo.submodules

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM