debian-mirror-gitlab/doc/user/project/merge_requests/cherry_pick_changes.md
2021-03-11 19:13:27 +05:30

3 KiB

stage group info type
Create Source Code To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments reference, concepts

Cherry-pick changes (FREE)

GitLab implements Git's powerful feature to cherry-pick any commit with introducing a Cherry-pick button in merge requests and commit details.

Cherry-picking a merge request

After the merge request has been merged, a Cherry-pick button displays to cherry-pick the changes introduced by that merge request.

Cherry-pick Merge Request

After you click that button, a modal displays a branch filter search box where you can choose to either:

  • Cherry-pick the changes directly into the selected branch.
  • Create a new merge request with the cherry-picked changes.

Cherry-pick tracking

Introduced in GitLab 12.9.

When you cherry-pick a merge commit, GitLab displays a system note to the related merge request thread. It crosslinks the new commit and the existing merge request.

Cherry-pick tracking in Merge Request timeline

Each deployment's list of associated merge requests includes cherry-picked merge commits.

NOTE: We only track cherry-pick executed from GitLab (both UI and API). Support for tracking cherry-picked commits through the command line is planned for a future release.

Cherry-picking a commit

You can cherry-pick a commit from the commit details page:

Cherry-pick commit

Similar to cherry-picking a merge request, you can cherry-pick the changes directly into the target branch or create a new merge request to cherry-pick the changes.

When cherry-picking merge commits, the mainline is always the first parent. If you want to use a different mainline, you need to do that from the command line.

Here's a quick example to cherry-pick a merge commit using the second parent as the mainline:

git cherry-pick -m 2 7a39eb0