I would like to commit a file with a custom date.
So far I’ve created a Commit object, but I don’t understand how to bind it to a repo.
from git import *
repo = Repo('path/to/repo')
comm = Commit(repo=repo, binsha=repo.head.commit.binsha, tree=repo.index.write_tree(), message='Test Message', committed_date=1357020000)
Thanks!
Well I found the solution.
I wasn’t aware, but I had to provide all the parameters otherwise the Commit object would throw a BadObject exception when trying to serialize it.
After creating the commit object, a proper SHA had to be placed, I didn’t have a clue how this was done, but a little bit of research in the guts of GitPython source code got me the answer.
Then set the commit as the HEAD commit