sgpksw
Last Updated: September 13, 2016
·
32.82K
· jodosha
Avatar white

Git cherry-pick from another repository

Let's say you want to apply some patches from someone else repository:

# Cloning our fork
$ git clone git clone git@github.com:ifad/rest-client.git

# Adding (as "endel") the repo from we want to cherry-pick
$ git remote add endel git://github.com/endel/rest-client.git

# Fetch their branches
$ git fetch endel

# List their commits
$ git log endel/master

# Cherry-pick the commit we need
$ git cherry-pick 97fedac

# Pushing to our master
$ git push origin master
Say Thanks
Respond

4 Responses
Add your response

4239

Excellent, just what I needed. I needed to change git:// to git@ for this to work for me.

over 1 year ago ·
14078
Vt6n9269

Or light version:
git fetch <remote-git-url> <branch> && git cherry-pick SHA1

For example:
git fetch https://github.com/antonbabenko/imagepush2 && git cherry-pick 20258def3280b4ccba286c4a021140c66292ebc0

over 1 year ago ·
28054

Simple & great

over 1 year ago ·
28156
Charles

Thank you for your tip!

some trivial errors
1. git clone git clone git@github.com:ifad/rest-client.git => git clone git@github.com:ifad/rest-client.git
2. git remote add endel git://github.com/endel/rest-client.git => git remote add endel https://github.com/endel/rest-client.git

over 1 year ago ·
Filed Under