git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Getting Commits from One Repository to Another

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
May 21, 2009, 09:12 UTC
Message-ID
<vpq8wkq95uu.fsf@bauges.imag.fr>
In-Reply-To
<20090521040451.GC8091@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> On Wed, May 20, 2009 at 07:37:54PM -0400, Big Lebowski wrote:
>
>> Essentially, when I came on a project, a git repository was made  
>> available to me (lets call that 'public_repo'). That repository was put up 
>> on an unfuddle account, as an initial check-in; it was not cloned from the 
>> repository they were working on (lets call that 'private_repo'). I wrote 
>> some code, and pushed it to the repository. Now that I guess they feel 
>> comfortable with me, they reveal to me the private_repo.
>>
>> How do I get my code from public_repo to private_repo?
>
> You could just repeat the push you made to public_repo to
> private_repo.

As I understand the situation, no, because the public repo was not a clone of the private one, but a fresh import (without history?). So, the ancestor of the commits of the OP do not exist in the private repository.

But don't panic, "git rebase" will be able to replay your history on another branch. The commands to type will be along the lines of:

cd public-repo git remote add private url-of-private-repo git fetch private # not sure about the exact syntax here: git rebase --onto private/master your-first-commit^ master

and then perhaps
git push private master
-- 
Matthieu
Previous: Jeff KingNext: Ryan
Message 3 of 5 in “Getting Commits from One Repository to Another”
  1. Big LebowskiMay 20, 2009
  2. Jeff KingMay 21, 2009
  3. Matthieu MoyMay 21, 2009
  4. RyanMay 21, 2009
  5. Jeff KingMay 22, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.