如何 git 使用 GitPython 库拉变基?

How to git pull rebase using GitPython library?

我正在使用 GitPython 库 (GitPython Documentation)

以下代码对于 git pull 工作正常,但是如何使用 git pull --rebase ?"

import git 

g = git.cmd.Git(git_dir)
g.pull()

我们需要为 git pull --rebase 添加任何函数或参数吗?

你试过了吗g.pull("--rebase")

如果您创建一个原始对象,例如: 起源=远程(回购,'origin')

你可以这样做: origin.pull(变基=真)

您可以对 git.cmd 对象执行相同的操作 g.pull(变基=真)