In Dulwich, how do I commit to a branch instead of to HEAD?
Asked Answered
V

1

4

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?

Vallie answered 1/8, 2011 at 21:33 Comment(0)
M
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

Marr answered 2/8, 2011 at 20:20 Comment(2)
An example can be found at https://mcmap.net/q/1781151/-dulwich-push-to-a-certain-branchFilicide
That example is for push rather than commit.Marr

© 2022 - 2024 — McMap. All rights reserved.