Loic Dachary
Loic Dachary

Reputation: 1084

GitPython equivalent of git update-ref?

I would like to create a new reference that is not a tag nor a branch, in the same way git update-ref would:

git update-ref refs/pull/201/head ac8d616ea3598e49935908e5685e72038a37cd8f

How can I do that with GitPython ? I found TagReference.create to create a tag and I probably need a similar.

Upvotes: 0

Views: 367

Answers (1)

Loic Dachary
Loic Dachary

Reputation: 1084

Contrary to tags or branch creation, there is no GitPython wrapper. Instead the git update-ref should be used via the GitCmd generic wrapper like so:

import git
r = git.Repo('.')
r.git.update_ref('foobar', '8d5f33071777bb59bb45adae178fa1fb69101e68')

Upvotes: 3

Related Questions