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

Using git-replace in place of grafts -- and publishing .git/refs/replace between repos?

From
DCDavid Chanters <david.chanters@googlemail.com>
Date
Sep 15, 2012, 12:02 UTC
Message-ID
<CACffvTp4qnHc3RHKDotEfvshVDqGtTX6eh6Fr-bmJSMUvTFN6g@mail.gmail.com>
Hi,

Earlier this month I asked how best to handle two branches without a common ancestor to sync changes from one branch to another. Initially I did this via the grafts mechanism, but this wasn't a "shared" solution, in that the graft was local to my checkout of the repository and no one else's.

I read on StackOverflow that git-replace can be used instead.  Having read this:
http://stackoverflow.com/questions/3810348/setting-git-parent-pointer-to-a-different-parent

I followed the instructions to use git-replace. Have successfully done that, I was then able to merge the two branches which didn't have a common ancestor and have the correct commits on the branch I was hoping for. AFAIAC, this worked fine.

But now I have some questions:
1.  I thought the replace data in .git/refs/replace was published when
I did "git push" so that others could use this information as a
base-point, yet it seems not to be the case.  How do I publish this?
2.  If I do publish it, are there any caveats with that?  i.e.,
because the replace data will likely point to a repo which in my
working checkout I added with "git-remote", is that going to be a
problem?  I assume I can instruct people who care, to "git remote add
foo ...." and then treat master and foo/master as intended?  i.e.,
foo/master will see commits on it over time which "master" won't have,
so "git checkout master && git merge foo/master" can always happen?
3.  If it is possible to publish this replace data, is there anything
which needs to happen in .git/config either on the bare repo or local
checkouts?

What I'm aiming for now, in publishing this merge, is that if I can publish the replace data, that people besides me, can clone the repo, and the remote repo in place, and merge the branches as outlined in question 2. What I also am unsure of is whether or not I have to keep updating the replace refs each time I merge the branch?

TIA!
David
Next: Junio C Hamano
Message 1 of 5 in “Using git-replace in place of grafts -- and publishing .git/refs/replace between repos?”
  1. David ChantersSep 15, 2012
  2. Junio C HamanoSep 15, 2012
  3. David ChantersSep 15, 2012
  4. Christian CouderSep 16, 2012
  5. Junio C HamanoSep 16, 2012

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.