Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As a hack, you can try modifying <a href="https://git.wiki.kernel.org/index.php/GitTips#How_to_compare_two_local_repositories" rel="noreferrer">recipe for comparing commits in two different repositories on GitTips page</a>, i.e.:</p> <pre><code>GIT_ALTERNATE_OBJECT_DIRECTORIES=../repo/.git/objects \ git cherry-pick $(git --git-dir=../repo/.git rev-parse --verify &lt;commit&gt;) </code></pre> <p>where <code>../repo</code> is path to the other repository. </p> <p>With modern Git you can use multiple revisions and revision ranges with <a href="https://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html" rel="noreferrer" title="git-cherry-pick(1) Manual Page - Apply the changes introduced by some existing commits">cherry-pick</a>.</p> <p>The <code>$(git --git-dir=../repo/.git rev-parse --verify &lt;commit&gt;)</code> is here to translate <code>&lt;commit&gt;</code> (for example <code>HEAD</code>, or <code>v0.2</code>, or <code>master~2</code>, which are values in the second repository you copy from) into SHA-1 identifier of commit. If you know SHA-1 of a change you want to pick, it is not necessary.</p> <p><strong>NOTE</strong> however that Git can skip copying objects from source repository, as it doesn't know that the alternate object repository is only temporary, for one operation. You might need to copy objects from the second repository with:</p> <pre><code>GIT_ALTERNATE_OBJECT_DIRECTORIES=../repo/.git/objects git repack -a -d -f </code></pre> <p>This puts those objects borrowed from second repository in original repository storage</p> <p><em>Not tested.</em></p> <hr> <p>A not so hacky solution is to follow <a href="https://stackoverflow.com/a/3816292/46058">knittl answer</a>:</p> <ul> <li>Go to second repository you want to copy commits from, and generate patches from commits you want with <code>git format-patch</code></li> <li>Optionally, copy patches (0001-* etc.) to your repository</li> <li>Use <code>git am --3way</code> to apply patches</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload