如何做一个混帐重置 - 使用gitPython? [英] How to do a git reset --hard using gitPython?

查看:129
本文介绍了如何做一个混帐重置 - 使用gitPython?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题是自我解释的。什么是相当于使用 GitPython 模块运行 git reset --hard (在终端上)的python代码?

解决方案

我在 reset rel =nofollow noreferrer>文档,并找到这个


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



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



将HEAD重置为给定的提交,可以同步索引和工作树。我们引用的参考将被设置为提交。



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

解决方案

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.

这篇关于如何做一个混帐重置 - 使用gitPython?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆