5

I am having a bit of a problem here, I want to cherry-pick a commit from a git repo that isn't locally present in my system.

For example : https://github.com/DespairFactor/N6/commit/ecea4ab6d3d8bb4122522398200f1cd2a06af6d5

A usual cherry-picking procedure includes doing

1) git remote add <RepoName> <repoURL>

2) git fetch <RepoName> and it downloads a copy but isn't merged to your own local repo.

3) git cherry-pick <commit SHA> and cherry-pick is done.

I have a very slow download speed (1 mbps), and I don't have enough time to download whole repo for 1 commit. Sorry if this question was already asked and answered.

kuttu
  • 55
  • 5

1 Answers1

6

You might consider to download the patch, then apply it locally.

To get the patch for a specific commit on GitHub, simply append the .patch suffix to the commit URL:

https://github.com/DespairFactor/N6/commit/ecea4ab6d3d8bb4122522398200f1cd2a06af6d5.patch

And some variant forms:

See: https://github.com/blog/967-github-secrets#diff-patch

ryenus
  • 15,711
  • 5
  • 56
  • 63
  • The first link is dead. – Sameer Oct 14 '20 at 17:48
  • Hi, Sameer, it's about the syntax, more specifically the `.patch` suffix, the repo url was from the question and it actually doesn't matter. – ryenus Jan 07 '21 at 05:32
  • 1
    `curl https://github.com/DespairFactor/N6/commit/ecea4ab6d3d8bb4122522398200f1cd2a06af6d5.patch | git am` – Andy Jun 19 '23 at 13:22