git 如何从一个分支到另一个分支挑选樱桃
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5304391/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to cherry pick from 1 branch to another
提问by michael
I have 2 branches, master
and dev
.
我有 2 个分支,master
并且dev
.
I am on dev
branch and I want to cherry-pick 1 commit from master
to dev
. So I did
我在dev
分支上,我想从master
to 中挑选 1 个提交dev
。所以我做了
$ git cherry-pick be530cec7748e037c665bd5a585e6d9ce11bc8ad
Finished one cherry-pick.
But when I do git status
and gitx
, I don't see my commit be530cec7748e037c665bd5a585e6d9ce11bc8ad
in git history.
但是当我执行git status
and 时gitx
,我be530cec7748e037c665bd5a585e6d9ce11bc8ad
在 git 历史中看不到我的提交。
How can I see my commit in the dev
branch?
如何在dev
分支中查看我的提交?
回答by CanSpice
When you cherry-pick, it creates a new commit with a new SHA. If you do:
当您挑选时,它会创建一个带有新 SHA 的新提交。如果你这样做:
git cherry-pick -x <sha>
then at least you'll get the commit message from the original commit appended to your new commit, along with the original SHA, which is very useful for tracking cherry-picks.
那么至少您会从附加到新提交的原始提交中获得提交消息,以及原始 SHA,这对于跟踪精选内容非常有用。