0

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.

Loic Dachary
  • 1,034
  • 1
  • 10
  • 24

1 Answers1

1

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')
Loic Dachary
  • 1,034
  • 1
  • 10
  • 24