小编lin*_*kdd的帖子

未提交的dirs与pygit2提交

我正在使用pygit2处理非裸存储库

index = repo.index
index.read()

# write in test/test.txt

index.add('test/test.txt')
treeid = index.write_tree()

repo.create_commit(
    'HEAD',
    author, committer,
    'test commit',
    treeid,
    [repo.head.oid]
)
Run Code Online (Sandbox Code Playgroud)

这很成功,但是当我执行时git status,我得到了这个:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   deleted:    test/test.txt
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   test/
Run Code Online (Sandbox Code Playgroud)

git reset --hard一切之后,一切都得到了解决.

有没有办法用pygit正确更新索引?

python git libgit2 pygit2

4
推荐指数
1
解决办法
607
查看次数

标签 统计

git ×1

libgit2 ×1

pygit2 ×1

python ×1