Jia*_*ang 38 git git-cherry-pick
我从我的分支机构的gerrit评论中选择了樱桃.在gerrit代码审查中,我有两个补丁集和我之前挑选过的补丁,所以现在我想做第二个补丁集,但是有冲突,我怎么能强制git接受所有的更改?谢谢!
CoD*_*anX 78
你可以告诉它总是喜欢你正在挑选的提交的更改:
git cherry-pick commitish --strategy-option theirs
Run Code Online (Sandbox Code Playgroud)
commitish可以是提交的SHA-1哈希,也可以是branch-name该分支的最新提交,branch-name~1用于之前的提交等.
如果您想反过来,请使用:
git cherry-pick commitish --strategy-option ours
Run Code Online (Sandbox Code Playgroud)
用于速记--strategy-optionIS -X(上部壳体X).
如果您已经处于冲突状态,只需执行
# add only conflicting files here
git checkout --theirs path/to/file
git add path/to/file
git cherry-pick --continue
Run Code Online (Sandbox Code Playgroud)
git cherry-pick -X theirs <commit-hash-you-want-to-force-cherry-pick-from>
我通常的工作流程如下:
假设我在主服务器上并且刚刚提交。
git cherry-pick -X theirs 5cf3412| 归档时间: |
|
| 查看次数: |
22740 次 |
| 最近记录: |