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

后端 未结 3 1720
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 11:06

    With git you have your own version of the repository. That you synchronise with others' repositories. With fetch you update your remote references, ie. refresh what others got. With checkout you switch to a specific revision. You want to do this, if you just started using this.

    Now if you are already following a remote branch, you might only need to update your local branch. That's what pull does for you. It applies all the changes in the remote branch to your local one. You need this if you're using it already you just want to update.

    cherry-pick let you pick one change from anywhere in the repository and will apply it on your local branch. It is handy if you're on a different branch for any reason but still need that specific change. Be aware that if you cherry-pick without pushing that change that this change is not persistent. It's committed to your local repository but not to the remote (it might be what you need in cases though).

    See more about git basics for example here

提交回复
热议问题