There is new version of 8 of my files which I have cloned , Those new 8 files are presented in a patchset which is not yet merged with the master,So I want to replace my old 8 files in local with that patchset without merging the master, How can I do it? (Gerrit)
There is new version of 8 of my files which I have cloned , Those new 8 files are presented in a patchset which is not yet merged with the master,So I want to replace my old 8 files in local with that patchset without merging the master, How can I do it? (Gerrit)
Share Improve this question edited Mar 11 at 19:25 Guildenstern 3,9622 gold badges28 silver badges54 bronze badges asked Mar 11 at 6:52 ABD saleemABD saleem 11 silver badge1 Answer
Reset to default 1Switch to the page of the patchset. You can find "DOWNLOAD" or "Download", depending on the Gerrit version, on the page. Press it and it shows a series of commands for checkout, cherry-pick, format-patch, and etc. Copy the git fetch
command before &&
and run it in the local repository to make sure the commit of the patchset is present in the local repository.
To use the 8 files of this commit to overwrite their counterparts in the working tree,
# multiple files in one command
git checkout $commit -- path/to/file1 path/to/file2 ...
# or one file in one command
git checkout $commit -- path/to/file1
git checkout $commit -- path/to/file2
If you want to apply the patch of this commit instead,
git cherry-pick $commit