git rebase : passing multiple strategy options

标签 git

git rebase ,可以使用 -X <strategy-option> 传递 merge 策略选项或 --strategy-option=<strategy-option> .然而,从手册页中不清楚是否可以传递多个选项(或者后续选项是否替换先前的选项),如果可以,正确的语法是否为 -X <opt1,opt2>-X <opt1> -X <opt2> .正在运行 git rebase --verbose -m -X <opt1> -X <opt2> <upstream>不会产生错误,但即使启用了详细输出,也没有迹象表明是应用了两个选项还是只应用了最后一个。

最佳答案

opt1,opt2,opt3 逗号分隔语法用于 git diff

D:\git\git\t>grep -E "\-X" *.sh|grep "\,"
t4047-diff-dirstat.sh:  test_must_fail git show -X=20,cumulative
t4047-diff-dirstat.sh:test_expect_success 'explicit defaults: -Xchanges,noncumulative,3' '
t4047-diff-dirstat.sh:  git diff -Xchanges,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat &&

不适用于 merge/ rebase 中的策略选项。

对于那些,需要多个 -Xopt1 -Xopt2

但我只能找到一个测试这种语法的实例,并且对于失败的情况:t3418-rebase-continue.sh

test_must_fail git rebase -i -s funny -Xopt -Xfoo master topic

所以在实践中,我不确定这是否会被使用。

initial commit (Nov 2009, Git v1.7.0-rc0)其中引入了-X,一次只用一个策略选项进行测试。

不过我看到一个例子,使用 git cherry-pick:

D:\git\git\t>grep -E "-X.*?-X"*.sh

t3418-rebase-continue.sh: test_must_fail git rebase -i -s funny -Xopt -Xfoo master 主题 t3510-cherry-pick-sequence.sh: test_expect_code 128 git cherry-pick -s -m $mainline --strategy=recursive -X patience -X 我们的初始..anotherpick &&

参见 t3510-cherry-pick-sequence.sh ,这uses the same strategy/options as git merge .

test_expect_code 128 git cherry-pick -s -m $mainline --strategy=recursive -X patience -X ours initial..anotherpick 

关于git rebase : passing multiple strategy options,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56800291/

相关文章:

git - 错误: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 Bad Gateway fatal

Git 无效的修订范围 Symfony2 Composer 外部包

SVN 到 Git 导入问题使用 "git svn clone"

node.js - 如何从 node.js package.json 文件克隆 Azure Dev Ops 存储库?

git - 无法安装 docker

ios - Github Actions - 在哪里上传证书和配置文件

linux - git pull 和文件权限

git - 如何查询 TFS 2013 API 以获取团队项目集合中的 git 存储库?

git - merge 可以更改分支的提交历史吗?

git - 如何保持 git 镜像同步(包括删除分支)?