Skip to content

Commit

Permalink
[March 30] Desktop 2.7: Cherry-picking commits (github#18378)
Browse files Browse the repository at this point in the history
* Create "Cherry-picking a commit"

* Fix filename

* Add link to git-cherry-pick documentation in glossary

* Initial outline

* Cherry-picking article

* Incorporate reviewer feedback
  • Loading branch information
ethanpalm authored Mar 30, 2021
1 parent d06ec38 commit b1ff6c1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
Binary file added assets/images/help/desktop/cherry-picking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Cherry-picking a commit
intro: You can pick a specific commit on one branch and copy the commit to another branch.
versions:
free-pro-team: '*'
---

### About Git cherry-pick

You can cherry-pick a commit on one branch to create a copy of the commit with the same changes on another branch. If you commit changes to the wrong branch or want to make the same changes to another branch, you can cherry-pick the commit to apply the changes to another branch. You can also use cherry-picking to apply specific changes before you are ready to create or merge a pull request. For example, if you commit a bug fix to a feature branch, you can cherry-pick the commit with the bug fix to other branches of your project.

You can also use cherry-picking when collaborating with a team. Some projects incorporate contributions by cherry-picking commits. For more information, see [Distributed Git - Maintaining a Project](https://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project#_rebase_cherry_pick) in the Git documentation.

### Cherry-picking a commit

{% data reusables.desktop.current-branch-menu %}
2. In the list of branches, click the branch that has the commit that you want to cherry-pick.
{% data reusables.desktop.history-tab %}
4. Drag the commit that you want to cherry-pick to the {% octicon "git-branch" aria-label="The branch icon" %} **Current Branch** menu and drop the commit on the branch that you want to copy the commit to.
![Dragging a commit to another branch in the Current Branch menu](/assets/images/help/desktop/cherry-picking.png)

### Further reading
- [git-cherry-pick](https://git-scm.com/docs/git-cherry-pick) in the Git documentation
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ versions:
{% link_in_list /stashing-changes %}
{% link_in_list /pushing-changes-to-github %}
{% link_in_list /reverting-a-commit %}
{% link_in_list /cherry-picking-a-commit %}
{% link_in_list /managing-tags %}
{% link_in_list /viewing-the-branch-history %}
{% topic_link_in_list /working-with-your-remote-repository-on-github-or-github-enterprise %}
Expand Down
2 changes: 1 addition & 1 deletion data/glossaries/external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
working tree is pointing to a new branch.
- term: cherry-picking
description: >-
To choose a subset of changes from a series of changes (typically commits) and record them as a new series of changes on top of a different codebase. In Git, this is performed by the `git cherry-pick` command to extract the change introduced by an existing commit on another branch and to record it based on the tip of the current branch as a new commit.
To choose a subset of changes from a series of changes (typically commits) and record them as a new series of changes on top of a different codebase. In Git, this is performed by the `git cherry-pick` command to extract the change introduced by an existing commit on another branch and to record it based on the tip of the current branch as a new commit. For more information, see [git-cherry-pick](https://git-scm.com/docs/git-cherry-pick) in the Git documentation.
- term: child team
description: >-
Within nested teams, the subteam that inherits the parent team's access
Expand Down

0 comments on commit b1ff6c1

Please sign in to comment.