0 votes
1 view
in Devops and Agile by (20k points)

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 [email protected]{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.

1 Answer

0 votes
by (28.4k points)

This chunk of code should do the magic:

$ git --git-dir=../<some_other_repo>/.git \ format-patch -k -1 --stdout <commit SHA> | \ git am -3 -k

Let us see what is going on here: 

The command git format-patch creates a patch from some_other_repo's commit specified by its SHA (-1 for one single commit alone). This same patch is piped to git am, which applies the patch locally (-3 means trying the three-way merge if the patch fails to apply cleanly).

Welcome to Intellipaat Community. Get your technical queries answered by top developers !