-->

In Dulwich, how do I commit to a branch instead of

2019-04-10 19:11发布

问题:

Apparently repo.do_commit(message='test commit', committer='Name ') only commits to refs/heads/master.

Is there a way to set the current commit ref to another one than refs/heads/master?

Or is the only way to commit to a branch by creating a Commit object (as shown in the tutorial in the documentation) and setting it's parent to be the one of the branches commit id?

Should this be true, which would then be the use of repo.do_commit other than committing to refs/heads/master?

回答1:

Creating a Commit object manually and then setting the tag is indeed the only way to commit to a non-HEAD branch in the last release.

do_commit() in trunk supports a "ref" argument that you can use to commit to other branches.

http://www.samba.org/~jelmer/dulwich/apidocs/dulwich.repo.BaseRepo.html#do_commit