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

refs/replace advice

From
PWPete Wyckoff <pw@padd.com>
Date
Jul 29, 2011, 15:31 UTC
Message-ID
<20110729153122.GA4535@padd.com>

I've got two near-identical git repos, both imported from gigantic upstream p4 repos. They started at slightly different times so have different commit SHA1s, even though the tree contents are the same. I can't filter-branch either of them; too many users already.

I'm trying to use "git replace" to avoid cloning the entire set of duplicate commits across a slow inter-site link. Like this:

    ...---A----B----C   site1/top
                     \
                      D---E---F  site1/proj
    ...---A'---B'---C'  site2/top
It is true that "git diff C C'" is empty:  they are identical.

This set of commands, run from site2, clones most of the repo locally (up to C'), then grabs the few changes D..F from the faraway site1:

    git clone /path/to/site2.git repo
    cd repo
    git remote add -f site1 /path/to/faraway/site1.git

But it causes an entire fetch of all commits because C != C'. I'd prefer it just to fetch D, E and F. So I try:

    git refs replace A' A

but it still fetches everything. I toyed with grafting site1's A on top of the parent of our local A':

    echo A A'^ > .git/info/grafts
no luck.

I thought maybe I could "git fetch --depth=N" where N would cover the range A'..site2/top, then replace. But testing with "git fetch --depth=3" still wants to fetch 100k objects.

Any ideas?
                -- Pete
Next: Johannes Sixt
Message 1 of 4 in “refs/replace advice”
  1. Pete WyckoffJul 29, 2011
  2. Johannes SixtJul 29, 2011
  3. Pete WyckoffJul 29, 2011
  4. Pete WyckoffAug 2, 2011

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.