Problem: You want to test a feature someone has developed, but it only exists in a remote branch which is woefully out of date.
- cherry-pick 如何解决问题?
- 为什么我不使用 git am 或 git apply?
最佳答案
Problem: You want to test a feature someone has developed, but it only exists in a remote branch which is woefully out of date.
如果您 merge 或 rebase ,您会得到一堆旧的更改,可能会发生冲突。
通过 cherry picking,您可以获取一个更改集,并将其作为新提交重播到另一个分支。
如果您只想将一个提交到另一个分支,而不需要其历史记录,这将很有用。
使用 -x
选项很有用,因此提交消息包含一个注释,它是从哪里挑选出来的。
Why won't I use git am or git apply?
因为 git apply 是打补丁(文件),而 git am 是打补丁系列。 git cherry-pick 应用提交 - 即,从您自己的存储库提交,与从其他存储库导入的提交。
关于git - cherry-pick - HOWTO/WHYTO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13522664/