From b19e13e43ea9f4c9c58c2fb4eb30abf1b2a0a233 Mon Sep 17 00:00:00 2001 From: Kevin Broch Date: Mon, 2 Dec 2024 17:38:26 -0800 Subject: [PATCH] example of using repo foreach to cherry-pick change Signed-off-by: Kevin Broch --- projects/rvi-repo-manifest/README.adoc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/projects/rvi-repo-manifest/README.adoc b/projects/rvi-repo-manifest/README.adoc index 9c653b2..bffcc28 100644 --- a/projects/rvi-repo-manifest/README.adoc +++ b/projects/rvi-repo-manifest/README.adoc @@ -48,6 +48,25 @@ After `repo init` is done once, `repo sync` can be used to clone the initial rep NOTE: All `git` commands will continue to work in the individual projects as expected. +==== Cherry-pick edits across multiple repos (or how to use `repo foreach` to do work across multiple repos) + +The goal of the example is to cherry-pick a commit from another repo and apply it to other repos using link:https://source.android.com/docs/setup/reference/repo#forall[`repo forall`] + +NOTE: This example only shows doing it for one repo but the changes could be more broadly applied. + +* create a dev branch: +** `repo start dev/kbroch/dependabot-update-docs-resources-submodule riscv/riscv-isa-manual` +* add remote that contains commit you want to cherry-pick: +** `repo forall riscv/riscv-isa-manual -v -c 'echo $REPO_PROJECT; git remote add docs-spec-template git@github.com:riscv/docs-spec-template.git'` +* fetch the remote above: +** `repo forall riscv/riscv-isa-manual -v -c 'echo $REPO_PROJECT; git fetch docs-spec-template'` +* cherry-pick the commit wanted: +** `repo forall riscv/riscv-isa-manual -v -c 'echo $REPO_PROJECT; git cherry-pick 5c19f62e25aeeda69886b07e7ec2959b1e632735'` +* push changes: +** `repo forall riscv/riscv-isa-manual -v -c 'echo $REPO_PROJECT; git push origin HEAD'` + +NOTE: At this point, PRs need to be created individually. + === Dev tasks ==== Generating a manifest file