gerrit - git(pull vs checkout vs cherrypick)这是为了什么? [英] gerrit - git (pull vs checkout vs cherrypick) which is for what?

查看:955
本文介绍了gerrit - git(pull vs checkout vs cherrypick)这是为了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android的gerrit ex:链接中,要下载该补丁,我会看到4个选项。


  1. 回购下载

  2. 结帐

  3. >
  4. cherry-pick

它们之间的区别是什么?

这是我对他们的看法。请澄清


  1. 回购下载 - >下载完整源代码(项目中的所有git回购)直到此次提交
  2. $
  3. 结账 - >不确定它是什么。

  4. pick - >它试图只下载这个改变并将它合并到源代码中。

我知道pull和checkout是不同的从樱桃采摘。但它们又有什么不同?

解决方案

你是对的第一个。以下是其他人:
$ b

  • 结帐 获取最新更改。你应该已经有这个回购下载。它不会合并这些新更改,但会使您的工作目录反映它们。您可以稍后将它们合并。


  • 提取更改并将它们合并到同名的本地分支中

  • Cherry-pick 提取提交并在当前本地分支之上播放,因此完全创建新提交,它发生的变化与它提取的变化相同。 而不是它们在 git 中的实际含义。 checkout cherry-pick 不会自动获取更改。 checkout 只需将 HEAD 指定给您的提交,从而使工作目录与提交时的工作目录完全相同。同样, cherry-pick 用于重放您已有本地访问权限的提交。


    In Android's gerrit ex: link, to download the patch, I see 4 options.

    1. repo download
    2. checkout
    3. pull
    4. cherry-pick

    What is the difference between them?

    Here is what I think of them. Please clarify

    1. repo download --> Downloads full source code(of all git repos in the project) till this commit
    2. checkout --> Not sure what it is.
    3. pull --> Not sure what it does?
    4. cherry-pick --> It tries to download only this change and merge it into the source code.

    I know that pull and checkout are different from cherry-pick. But how are they different?

    解决方案

    You are right about the first one. Here are the rest of them:

    1. Checkout: Fetches the latest changes. You should already have this repo downloaded. It does not merge those new changes but makes your working directory reflect them. You can merge them at your leisure later.

    2. Pull: Fetches the changes AND merges them into the local branch of the same name.

    3. Cherry-pick: Fetches the commit and plays it on top of the current local branch, thus creating an entirely new commit which happens to have same changes as the one it fetched.

    They are a little different than what they actually mean in git. checkout and cherry-pick don't automatically fetch the changes. checkout just takes HEAD to a commit you specify, thus making working directory exactly as it was at that commit. Likewise, cherry-pick is used to replay commits which you already have local access to.

    这篇关于gerrit - git(pull vs checkout vs cherrypick)这是为了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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