git樱桃采摘到另一个分支 [英] git cherry-pick to another branch
问题描述
例如,我有两个分支: master
和 parallel_version
。
我在 parallel_version
分支,我发现这些分支的共同文件存在一个错误。
我修复了它并提交了。如何将此提交复制到另一个分支,假设我正在使用git-svn?
通常我会这样做:
$ git checkout master
$ git cherry-pick parallel_version
$ git checkout parallel_version
有没有更好的方法来做到这一点?
简单想象一下如果发生无法自动解决的冲突会发生什么。出于同样的原因,你也不能更新目前没有签出的分支(即使快进是可能的)。
I wonder if there is the way to copy one commit to another branch without checking out that branch.
For example, I have two branches: master
and parallel_version
.
I'm on parallel_version
branch and I found a bug in file common for these branches.
I've fixed it and committed. How to duplicate this commit to another branch, assuming I'm using git-svn?
Normally I would do:
$ git checkout master
$ git cherry-pick parallel_version
$ git checkout parallel_version
Is there better way of doing that?
That's not possible - simply imagine what would happen if there was a conflict that couldn't be resolved automatically. For the same reason you also can't update branches that are not currently checked-out (even if a fast-forward was possible).
这篇关于git樱桃采摘到另一个分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!