To be more pythonic: merged methods create_reference and create_reference_symbolic
and added force-Option. To make a new symbolic reference you have provide symbolic=True
as an additional parameter. If force=True references will although be overridden.
Otherwise an exception is raised if the references exists.
Examples:
# normal reference
repo.create_reference('refs/heads/foo', repo.head.hex)
# override reference with new value
repo.create_reference('refs/heads/foo', repo.head.hex, force=True)
# symbolic reference
repo.create_reference('refs/tags/foo', 'refs/heads/master', symbolic = True)
You do not have to lookup and resolve the HEAD reference anymore if you simply want
the last commit. Repository has now a head-getter which combines all these steps.
example:
repo = Repository('.')
head = repo.head
print(head.message)