gpt4 book ai didi

git - 为什么 git 的 cherry picking 不止一次提交会失败?

转载 作者:太空狗 更新时间:2023-10-29 13:03:35 33 4
gpt4 key购买 nike

我尝试 merge 两个 repo 协议(protocol),产生一个平坦的(又名交错的)历史记录。我按照 https://stackoverflow.com/a/14839653/188108 的方式执行此操作,在“历史重写:”下。

要 merge 的两个分支在“master”和“src/master”中。然后,我写:

$ git checkout --orphan new-master
$ git cherry-pick 9d325d6d 3f4c52ba
error: a cherry-pick or revert is already in progress
hint: try "git cherry-pick (--continue | --quit | --abort)"
fatal: cherry-pick failed
$ git cherry-pick 9d325d6d && git cherry-pick 3f4c52ba
[new-master 10f0277] Initial revision.
7 files changed, 194 insertions(+)
create mode 100644 __init__.py
create mode 100644 manage.py
create mode 100644 samples/__init__.py
create mode 100644 samples/models.py
create mode 100644 samples/views.py
create mode 100644 settings.py
create mode 100644 urls.py
[new-master 08e083c] Fixed field name in SixChambersLayer. Added Sample.current_place.
1 file changed, 2 insertions(+), 1 deletion(-)

那么,为什么第一个 cherry pick 命令失败,但 split 命令有效?我使用 git 1.9.1。

最佳答案

改为尝试:

git cherry-pick 9d325d6d^..3f4c52ba

正如我在“How to cherry pick a range of commits and merge into another branch”中提到的:

In the "cherry-pick A..B" form, A should be older than B.
If they're the wrong order the command will silently fail.

If you want to pick the range B through D (inclusive) that would be B^..D.

关于git - 为什么 git 的 cherry picking 不止一次提交会失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25471836/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com