Created
March 30, 2020 09:15
-
-
Save lig/dc1ede7e09488a62116fe90aa31617d9 to your computer and use it in GitHub Desktop.
pygit2 create commit simple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygit2 | |
repo = pygit2.Repository(path='.') | |
repo.index.add_all() | |
repo.index.write() | |
tree = repo.index.write_tree() | |
parent, ref = repo.resolve_refish(refish=repo.head.name) | |
repo.create_commit( | |
ref.name, | |
repo.default_signature, | |
repo.default_signature, | |
"Commit message", | |
tree, | |
[parent.oid], | |
) |
Thank you for posting this!! Very helpful in a module I'm writing. PyGit2 is severely under documented....
Thank you for posting this!! Very helpful in a module I'm writing. PyGit2 is severely under documented....
It is still very badly documented. I must write custom git server as a part of web ide project of for final project course. Can anybody recommend some good docs, please?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@karolzlot Thanks! But this goes beyond the purpose of this gist.