gerrit - git (pull vs checkout vs cherrypick) which is for what?

后端 未结 3 1627
Happy的楠姐
Happy的楠姐 2021-01-30 10:16

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 th

3条回答
  •  离开以前
    2021-01-30 10:51

    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.

提交回复
热议问题