Create a commit using pygit2
2015-04-06 10:41 user1479699 imported from *I would like to make a commit on a branch (master for example).
I am making a repository clone using
pygit2
(pygit2.clone_repository
)Then I change an existing file in the repository.
Afterwards I run this to make a commit:
index = repository.index
index.add_all()
index.write()
author = pygit2.Signature(user_name, user_mail)
commiter = pygit2.Signature(user_name, user_mail)
tree = repository.TreeBuilder().write()
oid = repository.create_commit(reference, author, commiter, message,tree,[repository.head.get_object().hex])But when i go to the repository and run
git status
:On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: test.txtThe modified file seems to be added for commit but the commit did not succeed. Using the returned Oid i can find the commit attribute in the pygit2 repository.
Did I miss something ?
相关文章
- Create a Solution using the Wizard 使用向导创建解决方案
- Python3 pip命令报错:Fatal error in launcher: Unable to create process using '"'
- Fatal error in launcher: Unable to create process using '"'
- Fatal error in launcher: Unable to create process using '"'
- Eclipse 4.2 (Juno) 'Cannot create a server using the selected type' in Tomcat 7 - Stack Overflow.html
- (iOS, XCode 4.2) Setting bundle version using Git post-commit hook causes my project to turn into a Mac project
- Amber学习第四天:Using Antechamber to Create Leap Input Files
- 004.Create a web app with ASP.NET Core MVC using Visual Studio on Windows --【在 windows上用VS创建mvc web app】
- Create a bridge using a tagged vlan (8021.q) interface
- How do I create an IIS application and application pool using InnoSetup script