Reputation: 139
I want to make a checkout on a version of a Git repository in Python. I am using the following code lines:
from git import Git
g = Git(os.getcwd())
g.checkout(row[2])
the question is how can I make a forced checkout?
Upvotes: 0
Views: 1210
Reputation: 2370
From the documentation, the checkout method takes keyword arguments:
g.checkout(row[2], force=True)
Should do what you want.
Upvotes: 1
Reputation: 160
According to reference checkout
function takes first optional argument force=False checkout(force=False, **kwargs)
Therefore, you can just simply call it with first argument force=True, to force the force checkout, like this
g.checkout(force=True, row[2])
Upvotes: 0