skip to navigation
skip to content

gitsubrepo 1.1.0

Provides access to `git subrepo` in Python

Git Subrepo Python Wrapper

In the same way that `GitPython <>`__ wraps git, this library provides easy access to git subrepo in Python.

How to use


  • git >= 2.10.0 (on path)
  • git-subrepo >= 0.3.1
  • python >= 3.6


Stable releases can be installed via PyPI:

$ pip install gitsubrepo

Bleeding edge versions can be installed directly from GitHub:

$ pip install git+${commitIdBranchOrTag}#egg=gitsubrepo

To declare this library as a dependency of your project, add it to your requirement.txt file.


The library currently supports 3 git subrepo operations: clone, pull and status. Please see the documentation for specific information on how to use these methods.

Example usage:

import gitsubrepo

remote_repository = ""
repository_location = "/tmp/repo"
subrepo_location = f"{repository_location}/subrepo"
branch = "develop"

commit_reference = gitsubrepo.clone(remote_repository, subrepo_location, branch=branch)
updated_commit_reference = gitsubrepo.pull(subrepo_location)

subrepo_remote, subrepo_branch, subrepo_commit = gitsubrepo.status(subrepo_location)
assert subrepo_remote == remote_repository
assert subrepo_branch == branch



Install both library dependencies and the dependencies needed for testing:

$ pip install -q -r requirements.txt
$ pip install -q -r test_requirements.txt


To run the tests and generate a coverage report with unittest:


If you wish to run the tests inside a Docker container, build Docker.test.


MIT license.

Copyright (c) 2017 Genome Research Limited

File Type Py Version Uploaded on Size
gitsubrepo-1.1.0.tar.gz (md5) Source 2017-08-08 7KB