2019-09-04 21:01:54 +05:30
---
2020-10-24 23:57:45 +05:30
stage: Create
group: Source Code
2021-02-22 17:27:13 +05:30
info: 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
2019-09-04 21:01:54 +05:30
type: reference, concepts
---
2016-09-29 09:46:39 +05:30
2019-09-04 21:01:54 +05:30
# Cherry-pick changes
2016-09-29 09:46:39 +05:30
2019-09-04 21:01:54 +05:30
GitLab implements Git's powerful feature to
[cherry-pick any commit ](https://git-scm.com/docs/git-cherry-pick "Git cherry-pick documentation" )
2018-03-17 18:26:18 +05:30
with introducing a **Cherry-pick** button in merge requests and commit details.
2016-09-29 09:46:39 +05:30
2018-03-17 18:26:18 +05:30
## Cherry-picking a merge request
2016-09-29 09:46:39 +05:30
2018-03-17 18:26:18 +05:30
After the merge request has been merged, a **Cherry-pick** button will be available
to cherry-pick the changes introduced by that merge request.
2016-09-29 09:46:39 +05:30
![Cherry-pick Merge Request ](img/cherry_pick_changes_mr.png )
2018-12-13 13:39:08 +05:30
After you click that button, a modal will appear showing a [branch filter search box ](../repository/branches/index.md#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.
2016-09-29 09:46:39 +05:30
2020-04-08 14:13:33 +05:30
### Cherry-pick tracking
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2675) in GitLab 12.9.
When you cherry-pick a merge commit, GitLab will output a system note to the related merge
request thread crosslinking the new commit and the existing merge request.
![Cherry-pick tracking in Merge Request timeline ](img/cherry_pick_mr_timeline_v12_9.png )
Each deployment's [list of associated merge requests ](../../../api/deployments.md#list-of-merge-requests-associated-with-a-deployment ) will include cherry-picked merge commits.
2021-02-22 17:27:13 +05:30
NOTE:
2020-06-23 00:09:42 +05:30
We only track cherry-pick executed from GitLab (both UI and API). Support for [tracking cherry-picked commits through the command line ](https://gitlab.com/gitlab-org/gitlab/-/issues/202215 ) is planned for a future release.
2020-04-08 14:13:33 +05:30
2019-09-04 21:01:54 +05:30
## Cherry-picking a commit
2016-09-29 09:46:39 +05:30
2019-09-04 21:01:54 +05:30
You can cherry-pick a commit from the commit details page:
2016-09-29 09:46:39 +05:30
![Cherry-pick commit ](img/cherry_pick_changes_commit.png )
2018-03-17 18:26:18 +05:30
Similar to cherry-picking a merge request, you can opt to cherry-pick the changes
directly into the target branch or create a new merge request to cherry-pick the
changes.
2016-09-29 09:46:39 +05:30
Please note that when cherry-picking merge commits, the mainline will always be the
first parent. If you want to use a different mainline then you need to do that
from the command line.
Here is a quick example to cherry-pick a merge commit using the second parent as the
mainline:
2020-03-13 15:44:24 +05:30
```shell
2016-09-29 09:46:39 +05:30
git cherry-pick -m 2 7a39eb0
```
2019-09-04 21:01:54 +05:30
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X` .
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->