我正在使用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正确更新索引?