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

Re: 'git replace' and pushing

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Nov 25, 2010, 08:37 UTC
Message-ID
<4CEE2060.4020507@drmicha.warpmail.net>
In-Reply-To
<AANLkTinzPCeCJ486cysmk981HE61=dv9MS7E8Ap4rQ5r@mail.gmail.com>
Cory Fields venit, vidit, dixit 24.11.2010 05:33:
Show 12 quoted lines
> I am having some trouble understanding how a replaced object (commit)
> should behave when pushed to a remote repo. Here's my scenario:
> 
> We are moving from svn to git. Our svn repo is huge, and most of the
> history is useless. To save space, I would like to do a 50/50 split so
> that when the repo is cloned, 50% is seen by default, and the
> historical 50% can be seen by fetching the replacement history. I've
> done this by creating a phony snapshot at 3 then using a 'replace' to
> put the others on top. The history is purely linear.
> 
> 1---2---3---4---5
>                  \---4---5

I assume the "other" 4 goes off 3 (you're not using a monospaced font, are you?).

Also, the other 4 should have no parent, otherwise you've not cut-off any history.

Show 10 quoted lines
> 
> When the replacement is in place, the repo is half size (commit-wise)
> as expected. The problem is that 'git push' does not honor the
> replace. So when I push, all objects go with it, which defeats the
> purpose. The only way that seams to work is doing a filter-branch and
> replacing the other way.
> 
> Is this by design? I would really like a way to split the repo without
> breaking hashes for the developers that have already begun using git
> svn.

It is by design since a replace creates a "fake history", and this should not be created behind a users back.

The 5 is not rewritten, and it's ancestry contains the whole history. If that is the commit your developers have already and that you want to preserve then there's not much you can do.

You could try to push or pull your replacement refs first (refs/replace) but I don't think this will change what objects the push of 5 will transfer. Just have a try.

Michael
Previous: Cory FieldsNext: Cory Fields
Message 2 of 10 in “'git replace' and pushing”
  1. Cory FieldsNov 24, 2010
  2. Michael J GruberNov 25, 2010
  3. Cory FieldsNov 26, 2010
  4. Jonathan NiederNov 26, 2010
  5. Junio C HamanoNov 26, 2010
  6. Cory FieldsNov 27, 2010
  7. Martin von ZweigbergkNov 26, 2010
  8. Cory FieldsNov 27, 2010
  9. Jonathan NiederNov 27, 2010
  10. Cory FieldsNov 27, 2010

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.