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

Re: rebase parents, or tracking upstream but removing non-distributable bits

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 30, 2010, 23:14 UTC
Message-ID
<m37heqdfck.fsf@localhost.localdomain>
In-Reply-To
<or4o9uc2ny.fsf@livre.localdomain>
Alexandre Oliva <lxoliva@fsfla.org> writes:
Show 17 quoted lines
> On Dec 30, 2010, Jonathan Nieder <jrnieder@gmail.com> wrote:
> 
> > Alexandre Oliva wrote:
> >> Now, it looks like I might be able to pull from upstream if I maintain
> >> manually a graft file that named each upstream commit as an additional
> >> parent of the corresponding local rebase commit that brought it into my
> >> rewritten tree.  Workable, maybe, but this wouldn't help third parties
> >> that used my public repository.
> 
> > Have you looked into "git replace"?
> 
> As far as I could tell, it solves a complementary problem.  IIUC, it
> would enable me to replace objects (say files, trees or commits) in my
> local repository so as to remove objectionable stuff, but when I pushed
> a branch out of it, it would go out with the very stuff I'm not supposed
> to publish.  This is because AFAICT replace objects are not sent over
> the wire.

They are not sent by default, but they (refs/replace/*) can be send as any other ref.

Show 6 quoted lines
> 
> Even if they were, I still don't think it would be appropriate to use
> them, for I'm speaking of really different trees.  Publishing a commit
> replacement would, for anyone who had both my public repository and my
> upstream, affect not just the branches I published, but also those in
> upstream, which would be surprising and undesirable.
[...]
I guess what Jonathan had in mind was something like that:
* you have two branches, 'clean' and 'contaminated'
* you want to merge 'contaminated' into 'clean', but you don't
  want people to see history of 'contaminated'
* in your private repository you merge 'contaminated' into 'clear'
  (with --no-ff, just in case), save merge commit, then rewrite
  top commit to be ordinary commit not a merge commit; it would
  bring [redacted] changes but not history
* you replace merge-turned-ordinary commit with a proper merge
  commit
* you don't distribute replacement refs to public repository

Though I think that better solution would be feature-branch based workflow. Each feature is developed in seperate feature branch. If given feature is sutable for 'clean', you merge it into both 'clean' and in 'contaminated'. If it is not, you merge it only into 'contaminated'.

Hopefully that would help develop workflow for you.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Alexandre OlivaNext: Alexandre Oliva
Message 4 of 7 in “rebase parents, or tracking upstream but removing non-distributable bits”
  1. Alexandre OlivaDec 30, 2010
  2. Jonathan NiederDec 30, 2010
  3. Alexandre OlivaDec 30, 2010
  4. Jakub NarebskiDec 30, 2010
  5. Alexandre OlivaJan 5, 2011
  6. Yann DirsonDec 30, 2010
  7. Alexandre Erwin IttnerDec 30, 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.