Dulwich ~ push to a certain branch
Asked Answered
S

1

2

I would like to do the following with dulwich in an existing git repo:

  • change a file
  • commit
  • push to a certain branch (not master)

I read the documentation and also this post on SO, but I don't get it. Can someone explain how to chose a specific branch to push to?

Thanks

Soutine answered 15/5, 2013 at 9:48 Comment(0)
F
3

During the push phase, you can specify how you would like to update the refs in the remote repository.

E.g. (untested)::

 from dulwich.client import get_transport_and_path
 from dulwich.repo import Repo
 repo = Repo(".")
 client, path = get_transport_and_path("git+ssh://[email protected]/jelmer/foo")
 def update_refs(refs):
     refs["refs/heads/somebranch"] = repo["refs/heads/somebranch"].id
 client.send_pack(path, update_refs, repo.object_store.generate_pack_data)
Flapjack answered 10/6, 2013 at 0:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.