Is it possible to cherry-pick a commit from another git repository?

I’m working with a git repository that needs a commit from another git repository that knows nothing of the first.

Typically I would cherry-pick using the HEAD@{x} in the reflog, but because this .git knows nothing of this reflog entry (different physical directory), how can I cherry-pick this, or can I?

I’m using git-svn. My first branch is using git-svn of the trunk of a Subversion repo, and the next branch is using git-svn on a Subversion branch.

12 s
12

You’ll need to add the other repository as a remote, then fetch its changes. From there you see the commit and you can cherry-pick it.

Like that:

git remote add other https://example.link/repository.git
git fetch other

Now you have all the information to simply do git cherry-pick.

When done, you may want to remove the remote again, if you don’t need it any more, with

git remote remove other

More info about working with remotes here: https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes

Leave a Comment