You can cherry-pick CL patch set which is not merged yet.
Click the "Download" link on right top of the CL UI, and click the copy button in the "Cherry-Pick" line. Then the cherry-pick command is copied into clipboard.
Paste the command in the git repository and the patch set is cherry-picked.
$ git fetch ssh://[email protected]:29418/Example refs/changes/02/2/1 && git cherry-pick FETCH_HEAD
来自 ssh://gerrit.yuneec.com:29418/Example
* branch refs/changes/02/2/1 -> FETCH_HEAD
[master 919f943] Add a sample change
Date: Mon Jul 3 16:26:29 2017 +0800
1 file changed, 1 insertion(+)
$ git log
commit 919f943ad1b0cd1a0fcf624bda9a4f9dadec1af8
Author: 杨海 <[email protected]>
Date: Mon Jul 3 16:26:29 2017 +0800
Add a sample change
Change-Id: Iece5e9d5d3468fba7c7c79648e21fc3255ab2a12
commit 936e0a646fa1d4e48aa5bfcc1cff9f5df8dc5f56
Author: 杨海 <[email protected]>
Date: Mon Jul 3 16:12:41 2017 +0800
Add readme file
Change-Id: I90bb9b58c8ba920780e48545fe37a40f94225677
You can also get the offline patch file in "Archive" or "Patch-File" line, in format of diff, tgz, tar etc.
⚠️ You may get code conflict when cherry-pick CL and you have to resolve the conflict locally.
⚠️ By default, Gerrit provides the latest patch set of the CL. For example, following link provides patch set 6 of CL 5.
git fetch ssh://[email protected]:29418/Example refs/changes/05/5/6 && git cherry-pick FETCH_HEAD
You can change patch set to smaller one for cherry-pick like, like patch set 4 as below.
git fetch ssh://[email protected]:29418/Example refs/changes/02/5/4 && git cherry-pick FETCH_HEAD