Cherry Picking a Git Commit in Xcode
Xcode 11 adds support for cherry picking commits. Cherry picking involves taking a commit from one git branch and applying it to another branch. Cherry picking lets you apply a commit to a branch without having to merge all your recent commits into that branch.
Take the following steps to cherry pick a commit in Xcode.
- Open the source control navigator by pressing Cmd–2.
- Checkout the destination branch, the branch that will receive the cherry picked commit.
- Select the branch with the commit to cherry pick. Xcode’s editor will show all the commits for that branch.
- Select the commit.
- Right-click and choose Cherry-Pick.
- An alert will open asking if you want to cherry pick. Click the Cherry-Pick button.
Want to Learn More About Git?
Check out my version control book. It shows you how to do the most common git tasks without leaving Xcode. Some of the material covered in the book includes seeing the changes you made to your code, branching, and going back to earlier versions of your project.