git - cherry-pick - HOWTO / WHYTO [英] git - cherry-pick - HOWTO / WHYTO
问题描述
问题:您想测试某人开发的功能,但只有
存在于一个远远过时的远程分支中。
- Cherry-pick如何解决问题?
- 为什么我不使用git am或者git apply?
您想测试某人开发的功能,但只有
存在于远程分支中,这是远远不合时宜的。
<如果你合并或重新组合,你会得到一堆旧的变化,可能是冲突。
在挑选樱桃时,您需要一个更改集,并将其重新播放为另一个分支的新提交。 $ b
这是非常有用的,如果你只需要一个提交到另一个分支,没有它的历史。
使用 -x
选项,所以提交消息包含一个从哪里摘樱桃的笔记。
为什么我不使用git am或git apply?
因为git apply是用于应用补丁(文件),而git是用于应用一系列补丁。 git cherry-pick应用提交 - 即从您自己的回购提交,并提交您从其他回购进口。
Problem: You want to test a feature someone has developed, but it only exists in a remote branch which is woefully out of date.
- How does cherry-pick solve the problem?
- Why won't I use git am or 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.
If you merged or rebased, you'd get a bunch of old changes in, possibly conflicting.
With cherry picking, you take one change set, and replay that as a new commit over another branch.
This is useful if you just want one commit onto another branch, without its history.
It's useful to use the -x
option, so the commit message contains a note where it was cherry picked from.
Why won't I use git am or git apply?
because git apply is for applying patches (files), and git am for applying series of patches. git cherry-pick applies commits - i.e., commits from your own repo, vs commits you import from other repos.
这篇关于git - cherry-pick - HOWTO / WHYTO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!