Create a commit using pygit2

Create a commit using pygit2

2015-04-06 10:41 user1479699 imported from Stackoverflow

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.txt

The 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 ?

使用 pygit2 创建提交 - ChaunceyHao - 博客园

Create a commit using pygit2的更多相关文章

  1. zookeeper源码分析之五服务端(集群leader)处理请求流程

    leader的实现类为LeaderZooKeeperServer,它间接继承自标准ZookeeperServer.它规定了请求到达leader时需要经历的路径: PrepRequestProcesso ...

  2. zookeeper事务

    zookeeper事物操作,其实只是其multi操作的简单封装: public List<OpResult> multi(Iterable<Op> ops) 基本操作:new ...

  3. git cherry-pick简介

    本文编辑整理自: http://sg552.iteye.com/blog/1300713 http://web.mit.edu/bitbucket/git-doc/git-cherry-pick.tx ...

  4. Git - Tutorial [Lars Vogel]

    From: http://www.vogella.com/tutorials/Git/article.html Git - Tutorial Lars Vogel Version 5.6 Copyri ...

  5. Git - Tutorial官方【转】

    转自:http://www.vogella.com/tutorials/Git/article.html#git_rename_branch Lars Vogel Version 5.8 Copyri ...

  6. git plumbing 更加底层命令解析-深入理解GIT

    原文: http://rypress.com/tutorials/git/plumbing 本文详细介绍GIT Plumbing--更加底层的git命令,你将会对git在内部是如何管理和呈现一个项目r ...

  7. github pages

    http://zyip.github.io/facemaker/index echo "hello world" >>hello.htm git init git ad ...

  8. 【Android Developers Training】 71. 显示翻牌动画

    注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...

  9. 行政区划sql数据脚本

    行政区划sql数据脚本 IF (EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TB_Province]') ...

随机推荐

  1. java中四种操作(dom、sax、jdom、dom4j)xml方式详解与比较

    1)DOM(JAXP Crimson解析器)     DOM是用与平台和语言无关的方式表示XML文档的官方W3C标准.DOM是以层次结构组织的节点或信息片断的集合.这个层次结构允许开发人员在树中寻找特 ...

  2. Image.FrameDimensionsList 属性-----具体使用案例2

    图片的拆分 1.保存png图片 using System; using System.Collections.Generic;using System.ComponentModel;using Sys ...

  3. Generic Data Access Layer泛型的数据访问层

    http://www.codeproject.com/Articles/630277/Generic-Data-Access-Layer-GDA-Part-I http://www.codeproje ...

  4. OLAP、OLTP的介绍和比较

    OLTP与OLAP的介绍 数据处理大致可以分成两大类:联机事务处理OLTP(on-line transaction processing).联机分析处理OLAP(On-Line Analytical ...

  5. sdut 2934 人活着系列之平方数 (完全背包变形)

    题目链接 分析:完全背包的变形,每一层的d[]数组代表这一层的这个数新加入以后所构成的val的种类. #include <iostream> #include <cstdio> ...

  6. Js 读写cookies

    //写cookies函数 function setCookie(name, value)//两个参数,一个是cookie的名子,一个是值 { var Days = 30; //此 cookie 将被保 ...

  7. django - django 承接nginx请求

    # -*- coding: utf-8 -*- import os import sys import tornado.ioloop import tornado.web import tornado ...

  8. TS 流解码过程

    TS 流解码过程: 1. 获取TS中的PAT 2. 获取TS中的PMT 3. 根据PMT可以知道当前网络中传输的视频(音频)类型(H264),相应的PID,PCR的PID等信息. 4. 设置demux ...

  9. 【JSP】弹出带输入框可 确认密码 对话框

    <body> <input type="submit" value="删除历史全部订单" onclick="deleteall()& ...

  10. Solr DIH以Mysql为数据源批量创建索引

    演示使用solr管理后台,以mysql为数据源,批量建索引的方法 测试于:Solr 4.5.1, mmseg4j 1.9.1, Jdk 1.6.0_45, Tomcat 6.0.37 | CentOS ...