Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用GitPython使用--atomic推送多个分支_Python_Git_Atomic_Gitpython - Fatal编程技术网

使用GitPython使用--atomic推送多个分支

使用GitPython使用--atomic推送多个分支,python,git,atomic,gitpython,Python,Git,Atomic,Gitpython,我试图使用Git2.4中引入的--atomic特性,它允许您在一个命令中以原子方式推送多个分支。我可以从命令行成功运行此命令: git推送——原子原点branch1 branch2 branch3 但是,我无法通过GitPython使用Repo.git.push(“--atomic”、“origin”、“branch1 branch2 branch3”)实现这一点 在下面的错误中,我可以看到GitPython发送到命令行的命令是: git推送——原子原点branch1 branch2 branc

我试图使用Git2.4中引入的
--atomic
特性,它允许您在一个命令中以原子方式推送多个分支。我可以从命令行成功运行此命令:
git推送——原子原点branch1 branch2 branch3

但是,我无法通过GitPython使用
Repo.git.push(“--atomic”、“origin”、“branch1 branch2 branch3”)
实现这一点

在下面的错误中,我可以看到GitPython发送到命令行的命令是:
git推送——原子原点branch1 branch2 branch3
这正是从命令行成功运行的方法


有人能让它工作吗?

按照您写这篇文章的方式,您将分支作为一个带空格的参数传递。与此等效的外壳如下所示:

git push --atomic origin 'branch1 branch2 branch3'
Git不喜欢这样,因为您告诉它您想要推送一个包含空格的分支,并且分支名称中不允许有空格。相反,您希望使用多个参数编写命令:

Repo.git.push("--atomic", "origin", "branch1", "branch2", "branch3")

非常好用,很有道理,谢谢。但是,从错误输出中有一个需要澄清的问题:
cmdline:git push--atomic origin automationTestBranch1 automationTestBranch2
它声称发送到命令行的命令看起来与我从命令行成功运行的命令相同(并且我没有看到封闭对或“.”git真的是通过命令行发送该命令,还是这只是GitPython与git用于发出命令的不同api的表示?