简体   繁体   中英

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 .

I couldn't find any documentation on gitpython and my understanding of the API is limited.

Thanks to stsewd reply on Github issue, one should write

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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