Skip to main content

Cherry-picking a commit in GitHub Desktop

You can use GitHub Desktop to pick a specific commit on one branch and copy the commit to another branch.

Platform navigation

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 in the Git documentation.

Cherry-picking a commit

  1. GitHub Desktop で、 [現在のブランチ] をクリックします。

    リポジトリ バーのスクリーンショット。 ドロップダウン メニューを示す下向き矢印が付いた [Current Branch] というボタンがオレンジ色の枠線で囲まれています。

  2. In the list of branches, click the branch that has the commit that you want to cherry-pick.

    Screenshot of the "Current Branch" dropdown view. Under "Recent Branches", a branch, named "my-feature", is highlighted with an orange outline.

  3. 左サイドバーにある [履歴] をクリックします。

    サイドバーの [履歴] タブのスクリーンショット。 コミット一覧の上にある [履歴] というタブ ボタンがオレンジ色の枠線で強調表示されています。

  4. Select the commit you would like to cherry-pick.

    You can select one commit or select multiple commits using Command or Shift.

    You can select one commit or select multiple commits using Ctrl or Shift.

  5. Right-click the selected commit and click Cherry pick commit, then select the branch that you want to copy the commit to. You can also drag the commit that you want to cherry-pick from the "History" tab to the Current Branch dropdown menu, then drop the commit on the branch that you want to copy the commit to.

    Screenshot of the "History" tab and the "Current Branch" dropdown view. The cursor hovers over the "my-feature" branch, and "plus one" icons indicate the addition of one commit.

Further reading