git cherry pick和rebase失败

git cherry pick和rebase失败,git,git-rebase,git-cherry-pick,Git,Git Rebase,Git Cherry Pick,我的主题分支历史记录中有以下提交: (git lola) 基本上,我无意中合并了origin/receipt_search,我们在完成此功能分支方面改变了计划 我现在想从commit 75a78ce(底部)开始并应用 0743777 preview stuff 03a2279 be able to ahndle both rebatable and non-rebatable 1ff3d6c better sample number for preview of receipts 0a0f3ed

我的主题分支历史记录中有以下提交:

git lola

基本上,我无意中合并了origin/receipt_search,我们在完成此功能分支方面改变了计划

我现在想从commit 75a78ce(底部)开始并应用

0743777 preview stuff
03a2279 be able to ahndle both rebatable and non-rebatable
1ff3d6c better sample number for preview of receipts
0a0f3ed handle missing {tax receipt} replacement
0ce35c9 remove language files, should not be in git
5cc2b61 identify first key of transaction detail correctly to get data out of transaction record
def1132 sort out preview spinner
867c918 remove confusing commented out stuff
fec8c04 text tweak in phpdoc
以相反的顺序安装到新的分支上

1) 我试过git cherry pick:

git checkout 75a78ce
git checkout -b receipt_preview_sprint_to_finish
git cherry-pick fec8c04..0743777
应用第二次提交时,此操作失败:

On branch receipt_preview_sprint_to_finish
You are currently cherry-picking commit 867c918.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)

        both modified:   code/classes/class.receipting.php
分支机构收据上\u预览\u冲刺\u完成
您当前正在选择提交867c918。
(修复冲突并运行“git cherry pick--continue”)
(使用“git cherry pick--abort”取消cherry pick操作)
未合并路径:
(使用“git add…”标记分辨率)
两者都已修改:code/classes/class.receipting.php
我不明白为什么会有冲突

2) 然后我试着重新设置基址:

git branch -f integration 0743777
git rebase --onto receipt_preview_sprint_to_finish fec8c04~1 integration

    First, rewinding head to replay your work on top of it...
    Fast-forwarded integration to receipt_preview_sprint_to_finish.
    jochen@autolaptop4:~/projects/infoodle$ git log
    commit 3678770d92b2fd00797d2cda2875c090fc701a1e
    Author: Jochen Daum <jd@automatem.co.nz>
    Date:   Thu Mar 23 10:48:42 2017 +1300

        progress

    commit ed2ca95096690c4c419ef491ad65c3c5020120e5
    Merge: 30ef79c 0743777
    Author: Jochen Daum <jd@automatem.co.nz>
    Date:   Thu Mar 23 08:26:23 2017 +1300

        Merge branch 'receipt_preview' of bitbucket.org:richinnz/infoodle-web into receipt_preview

        # Conflicts:
        #   code/ajax/accountcode_functions.php
        #   code/ajax/subinclude/person.php
        #   code/styles/ennz/admin_donationreceipts.tpl.php
        #   code/styles/ennz/header.tpl
git分行-f集成0743777
git rebase--进入收据\u预览\u冲刺\u完成fec8c04~1集成
首先,倒带头部,在其上重放您的工作。。。
快进集成到接收、预览、冲刺和完成。
jochen@autolaptop4:~/projects/infoodle$git log
提交3678770D92B2FD00797D2CDA2875C0FC701A1E
作者:Jochen Daum
日期:2017年3月23日星期四10:48:42+1300
进步
提交ED2CA95096690C4C419EF491AD65C3C020120E5
合并:30ef79c 0743777
作者:Jochen Daum
日期:2017年3月23日星期四08:26:23+1300
将bitbucket.org:richinnz/infoodle web的分支“收据预览”合并到收据预览中
#冲突:
#code/ajax/accountcode_functions.php
#代码/ajax/subinclude/person.php
#code/styles/ennz/admin_donationreceipts.tpl.php
#代码/样式/ennz/header.tpl
但这两个承诺我特别不想要


我做错了什么?

git cherry pick的问题很简单:

现在我想从commit 75a78ce开始(在底部)并应用[commit以fec8c04开始,包括fec8c04,所以我运行了]

git cherry-pick fec8c04..0743777
Git中的符号
X..Y
表示“可从
Y
访问的所有提交,不包括可从
X
访问的所有提交”。这不包括
X
本身。这让人想起数学中的半开区间,其中[3..5]表示3、4和5,但(3,5)仅表示4和5,或[3,5)仅表示3和4。(这些是用其他方式书写的,例如]3,5]在一些符号中,和提交实际上不是线性的。这样我们实际上是在做集合减法,而不是间隔,但这里的想法是提醒大家,
X..Y
从不包括提交
X
本身。)

因此,您需要的是:

git cherry-pick 75a78ce..0743777
或:

包括提交
fec8c04

同样值得注意的是,这并不完全正确:

第二个命令应该是
git checkout-b
,而不是
git branch-b
。但是
git branch-b
会给您一个错误,所以我猜您实际使用了
git checkout-b
:-)


(git rebase的
git方法将无法正常工作,因为它将选择太多的提交以复制到线性序列中。)

cherry pick
命令中,您是真的编写了fec8c04..0743777,还是单独拼写了每个提交?我认为除非你想要一系列的承诺,否则你必须把它们都单独写出来。谢谢你,回答得很好。我编辑了git branch-b和git checkout-b的问题
git cherry-pick 75a78ce..0743777
git cherry-pick fec8c04^..0743777
git checkout 75a78ce
git branch -b receipt_preview_sprint_to_finish