GIT-DROVER(1)

NAME
git-drover - Apply a commit from the trunk to a release branch, or from one release branch to another.

SYNOPSIS

git drover --branch <branch>
           (--cherry-pick <change> | --continue [path_to_workdir] |
            --abort [path_to_workdir])
           [--parent_checkout <path-to-existing-checkout>]
           [--verbose] [--dry-run]

DESCRIPTION

git drover applies a commit to a release branch. It creates a new workdir from an existing checkout to avoid downloading a new checkout without affecting the existing checkout.

git drover does not support reverts. See the EXAMPLE section for the equivalent sequence of commands to run.

OPTIONS

--branch <branch>
    The branch to cherry-pick the commit to.

--cherry-pick <commit>
    The commit to cherry-pick.

--continue [path_to_workdir]
    Continue a cherry-pick that required manual resolution. The path to the drover workdir is optional. If unspecified, the current directory is used.

--abort [path_to_workdir]
    Abort a cherry-pick that required manual resolution and clean up its workdir. The path to the drover workdir is optional. If unspecified, the current directory is used.

--parent_checkout
    The path to the chromium checkout to use as the source for a creating git-new-workdir workdir to use for cherry-picking. If unspecified, the current directory is used.

-v, --verbose
    Enable verbose logging.

--dry-run
    Skip landing the cherry-pick. Just ensure that the commit can be cherry-picked into the branch.

EXAMPLE

  PREREQUISITES

Before working with branches, you must gclient sync --with_branch_heads at least once to fetch the branches.

Merge Example

        # Here's a commit (from some.committer) that we want to 'drover'.
        $ git log -n 1 --pretty=fuller
        commit 1f4859134ea36bfc71bab20d4b4463908860fd04
        Author:     some.committer <some.committer@chromium.org>
        AuthorDate: Thu Apr 10 08:54:46 2014 +0000
        Commit:     some.committer <some.committer@chromium.org>
        CommitDate: Thu Apr 10 08:54:46 2014 +0000
            This change needs to go to branch 9999
        # Now do the 'drover'.
        $ git drover --branch 9999 --cherry-pick 1f4859134ea36bfc71bab20d4b4463908860fd04
        Going to cherry-pick
        """
        commit 1f4859134ea36bfc71bab20d4b4463908860fd04
        Author: some.committer <some.committer@chromium.org>
        Date:   Thu Apr 10 08:54:46 2014 +0000
            This change needs to go to branch 9999
        """
        to 9999. Continue (y/n)? y
        # A cl is uploaded to rietveld, where it can be reviewed before landing.
        About to land on 9999. Continue (y/n)? y
        # The cherry-pick cl is landed on the branch 9999.

Merge with Conflicts Example

        # Here's a commit (from some.committer) that we want to 'drover'.
        $ git log -n 1 --pretty=fuller
        commit 351e3be4c0f2f65ff1bcbcafd2fd4c53ab3b4587
        Author:     some.committer <some.committer@chromium.org>
        AuthorDate: Thu Apr 10 08:54:46 2014 +0000
        Commit:     some.committer <some.committer@chromium.org>
        CommitDate: Thu Apr 10 08:54:46 2014 +0000
            This change needs to go to branch 9999
        # Now do the 'drover'.
        $ git drover --branch 9999 --cherry-pick 351e3be4c0f2f65ff1bcbcafd2fd4c53ab3b4587
        Going to cherry-pick
        """
        commit 351e3be4c0f2f65ff1bcbcafd2fd4c53ab3b4587
        Author: some.committer <some.committer@chromium.org>
        Date:   Thu Apr 10 08:54:46 2014 +0000
            This change needs to go to branch 9999
        """
        to 9999. Continue (y/n)? y
        Error: Patch failed to apply.
        A workdir for this cherry-pick has been created in
          /tmp/drover_9999
        To continue, resolve the conflicts there and run
          git drover --continue /tmp/drover_9999
        To abort this cherry-pick run
          git drover --abort /tmp/drover_9999
        $ pushd /tmp/drover_9999
        # Manually resolve conflicts.
        $ git add path/to/file_with_conflicts
        $ popd
        $ git drover --continue /tmp/drover_9999
        # A cl is uploaded to rietveld, where it can be reviewed before landing.
        About to land on 9999. Continue (y/n)? y
        # The cherry-pick cl is landed on the branch 9999.

Revert Example

        # Make sure we have the most up-to-date branch sources.
        $ git fetch
        # Checkout the branch with the change we want to revert.
        $ git checkout -b drover_9999 branch-heads/9999
        Branch 'drover_9999' set up to track remote ref 'refs/branch-heads/9999'.
        # Here's the commit we want to revert.
        $ git log -n 1
        commit 8f0c06e50f535e3fcca2b189bb6b5d106bb1e5e6
        Author: some.committer <some.committer@chromium.org>
        Date:   Thu Apr 10 08:54:46 2014 +0000
            This change is horribly broken.
        # Now do the revert.
        $ git revert 8f0c06e50f535e3fcca2b189bb6b5d106bb1e5e6
        # That reverted the change and committed the revert.
        $ git log -n 1
        commit 829317133eb319e61f222fea996ca2703cd27fbe
        Author: you <you@chromium.org>
        Date:   Thu Apr 10 09:11:36 2014 +0000
            Revert "This change is horribly broken."
            This reverts commit 8f0c06e50f535e3fcca2b189bb6b5d106bb1e5e6.
        # As with old drover, reverts are generally OK to commit without LGTM.
        $ git cl upload -r some.committer@chromium.org --send-mail
        $ git cl land --bypass-hooks

    If your cherrypick onto a release branch gets reverted, do not create a new cherrypick from master onto that release branch. Instead, use the "Reland" button on the original cherrypick CL.

Manual Merge Example

        # Make sure we have the most up-to-date branch sources.
        $ git fetch
        # Here's a commit (from some.committer) that we want to 'drover'.
        $ git log -n 1 --pretty=fuller
        commit ceb84b4befd7a7c060d210fdc57b3d0f46d68fa4
        Author:     some.committer <some.committer@chromium.org>
        AuthorDate: Thu Apr 10 08:54:46 2014 +0000
        Commit:     some.committer <some.committer@chromium.org>
        CommitDate: Thu Apr 10 08:54:46 2014 +0000
            This change needs to go to branch 9999
        # Checkout the branch we want to 'drover' to.
        $ git checkout -b drover_9999 branch-heads/9999
        Branch 'drover_9999' set up to track remote ref 'refs/branch-heads/9999'.
        # Now do the 'drover'.
        # IMPORTANT!!! Do Not leave off the '-x' flag
        $ git cherry-pick -x ceb84b4befd7a7c060d210fdc57b3d0f46d68fa4
        [drover_9999 bd9bd5b] This change needs to go to branch 9999
         Author: some.committer <some.committer@chromium.org>
         Date: Thu Apr 10 08:54:46 2014 +0000
         1 file changed, 1 insertion(+)
         create mode 100644 modified_file
        # That took the code authored by some.committer and committed it to
        # the branch by the person who drovered it (i.e. you).
        $ git log -n 1 --pretty=fuller
        commit bd9bd5b74ab9b942d127ddbefb99eec50b65fbf1
        Author:     some.committer <some.committer@chromium.org>
        AuthorDate: Thu Apr 10 08:54:46 2014 +0000
        Commit:     you <you@chromium.org>
        CommitDate: Thu Apr 10 09:11:36 2014 +0000
            This change needs to go to branch 9999
            (cherry picked from commit ceb84b4befd7a7c060d210fdc57b3d0f46d68fa4)
        # Looks good. Ship it!
        $ git cl upload
        # Wait for LGTM or TBR it.
        $ git cl land
        # Or skip the LGTM/TBR and just 'git cl land --bypass-hooks'

    If git cl upload errors out, the branch you’re uploading to probably has a CL with the same Change-Id. Instead of cherry-picking manually, use the Reland button in the Gerrit UI to create a new CL, and patch that CL into your client.

SEE ALSO

git-cherry-pick(1), git-revert(1)

CHROMIUM DEPOT_TOOLS

Part of the chromium depot_tools(7) suite. These tools are meant to assist with the development of chromium and related projects. Download the tools by checking out the git repository[1].

NOTES

1.  git repository
    https://chromium.googlesource.com/chromium/tools/depot_tools.git