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

Re: Clone with local alternates?

From
Eric W. Biederman <ebiederm@xmission.com>
Date
Apr 19, 2006, 09:36 UTC
Message-ID
<m1vet5oqk9.fsf@ebiederm.dsl.xmission.com>
In-Reply-To
<1145404132.16166.97.camel@shinybook.infradead.org>
David Woodhouse <dwmw2@infradead.org> writes:
Show 7 quoted lines
> Often I want to clone a remote repository but would like to use an
> existing local source tree as 'alternates'. 
>
> One way of doing this is to clone the local tree with 'git-clone -l -s',
> find the latest common commit shared with the remote tree to be fetched,
> revert to that with 'git-reset --head $last' and then pulling from the
> remote. 

Simpler than the git-reset you can simply do git-fetch remote branch:branch and git will find common ancestor for you and create a new branch that mirrors the old one.

I mention this because it can be interesting to have branches from several remote repositories all in one local repository.

Eric
Previous: Eric W. Biederman
Message 7 of 7 in “Clone with local alternates?”
  1. David WoodhouseApr 18, 2006
  2. Shawn PearceApr 18, 2006
  3. David WoodhouseApr 18, 2006
  4. Document git-clone --referenceShawn Pearce, Apr 19, 2006
  5. David WoodhouseApr 19, 2006
  6. Eric W. BiedermanApr 19, 2006
  7. Eric W. BiedermanApr 19, 2006

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.