python - GitPython——如何对 GitPython 存储库进行 'git stash' 更改?

标签 python git gitpython

我有一个通过 GitPython 库创建的存储库,其中有一些未提交的更改。我想 stash 这些更改。我该怎么做?

在 GitPython 中搜索“stash”docs没有返回任何结果。

最佳答案

根据文档,"Using git directly" :

In case you are missing functionality as it has not been wrapped, you may conveniently use the git command directly. It is owned by each repository instance.

因此,您可以调用 git stash save

repo.git.stash('save')

关于python - GitPython——如何对 GitPython 存储库进行 'git stash' 更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28265396/

相关文章:

python - 重构错误处理并在 Python 中获得正确的堆栈跟踪

python - 如何知道我的脚本是在后台运行还是在前台运行?

gitpython - 使用 gitpython 删除远程分支(推送原点 ':')

python - 使用gitpython时如何设置git用户名和密码?

python - 使用正则表达式解析 winerror.h 和 ntstatus.h 状态/定义

python - 如何在 ubuntu 后台运行 python 脚本?

git - 一个 git 命令中的多个 <pathspec>

git - 从不正确的 rebase 或 merge 中恢复

git - 如何在git repo中每次提交后确定每个文件中的代码行数

GitPython:如何检测文件是否被删除?