How to do a git reset --hard using gitPython?

前端 未结 3 1863
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 09:47

Well the title is self explanatory. What will be the python code equivalent to running git reset --hard (on terminal) using GitPython module?

3条回答
  •  自闭症患者
    2021-02-19 10:00

    I searched for reset in the documentation and found this:

    class git.refs.head.HEAD(repo, path='HEAD')

    reset(commit='HEAD', index=True, working_tree=False, paths=None, **kwargs)

    Reset our HEAD to the given commit optionally synchronizing the index and working tree. The reference we refer to will be set to commit as well.

提交回复
热议问题