樱桃采用git进行提交是什么意思? [英] What does cherry-picking a commit with git mean?

查看:148
本文介绍了樱桃采用git进行提交是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我被要求樱桃挑选一个提交。但我不知道这意味着什么。那么 cherry picking git中的提交是指什么?你怎么做呢?

解决方案

在git中挑选樱桃意味着从一个分支选择一个提交并将其应用到另一个分支。

这与 merge rebase 通常应用到另一个分支的许多提交。


  1. 确保您位于要应用提交的分支上

    git checkout master


  2. 执行以下操作:



    git cherry-pick


注意:


  1. - 从公共分支中选择,你应该考虑使用

    git cherry-pick -x< commit-hash>



    这将生成一个标准化的提交消息。这样,你(和你的同事)仍然可以跟踪提交的起源,并可能避免将来发生合并冲突。

  2. 如果你有附加注意事项他们不遵循樱桃选择。为了让他们也可以使用,您必须使用:

    git notes复制< from> < / code>


其他链接:


Recently, I have been asked to cherry pick a commit. But I have no idea what it means. So what does cherry picking a commit in git mean? How do you do it?

解决方案

Cherry picking in git means to choose a commit from one branch and apply it onto another.

This is in contrast with other ways such as merge and rebase which normally apply many commits onto another branch.

  1. Make sure you are on the branch you want to apply the commit to.

    git checkout master

  2. Execute the following:

    git cherry-pick <commit-hash>

N.B.:

  1. If you cherry-pick from a public branch, you should consider using

    git cherry-pick -x <commit-hash>

    This will generate a standardized commit message. This way, you (and your co-workers) can still keep track of the origin of the commit and may avoid merge conflicts in the future.

  2. If you have notes attached to the commit they do not follow the cherry-pick. To bring them over as well, You have to use:

    git notes copy <from> <to>

Additional links:

这篇关于樱桃采用git进行提交是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆