We now are offering Devs Base Swag. Get yours now.

[GUIDE] How to cherry pick a commit from Github

This is pretty simple and straight forward but a lot of people struggle with this and end up 'manually cherry picking' things which means just copying and pasting a commit and they almost always forget to amend authorship.

First thing you want to do is find the repo on Github you want to cherry pick off.

Once you find it, make a note of the URL of the repo and then move on to finding the commit you want to pick.


Once you find the commit, go ahead and make a note of the branch name you found the commit and also the commit ID or SHA as most developers call it.

For the sake of this guide, let's say you want to cherry pick off the DU fwb repo and you want to pick our swipe FP commit


This what you want to gather above
REPO - https://github.com/DirtyUnicorns/androi ... works_base
BRANCH - n7x
Commit ID / SHA - 05df2ef61fcd51f7a81cebb94ea15376bbb2e3ba

Open up a terminal and amusing you already have a repo you're working with, cd into it. Type in the following the get you started

git fetch https://github.com/DirtyUnicorns/android_frameworks_base.git -t n7x

Let it fetch the repo. Depending your internet connection this might take anywhere between a few seconds to a few minutes.

Once its done fetching, type in the following

git cherry-pick 05df2ef61fcd51f7a81cebb94ea15376bbb2e3ba

That's it, you've cherry picked your first commit! This doesn't guarantee that the commit itself won't have conflicts or that it will compile.


Please check other guides for how to solve common cherry pick conflicts and build errors.

Return to “Software Development How-Tos”

Who is online

Users browsing this forum: No registered users and 1 guest