1.2 KiB
1.2 KiB
The repository
Everything starts either by creating a new repository, or by opening an existing one.
Creating a repository
pygit2.init_repository
This is how to create non-bare repository:
>>> from pygit2 import init_repository
>>> repo = init_repository('test')
And this is how to create a bare repository:
>>> from pygit2 import init_repository
>>> repo = init_repository('test', bare=True)
But one can also do:
>>> from pygit2 import init_repository
>>> repo = init_repository('test', True)
The Repository class
To open an existing repository:
>>> from pygit2 import Repository
>>> repo = Repository('pygit2/.git')
pygit2.Repository.path
pygit2.Repository.workdir
pygit2.Repository.is_bare
pygit2.Repository.is_empty
pygit2.Repository.read
pygit2.Repository.write
pygit2.Repository.merge_base