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

Re: git-log - hide parent (was: merging two equivalent branches)

From
Avery Pennarun <apenwarr@gmail.com>
Date
Jan 8, 2010, 19:50 UTC
Message-ID
<32541b131001081150k3de53301tf6d206718d538a6@mail.gmail.com>
In-Reply-To
<DF05F91F-CBFD-458A-A99F-79E98ACA5146@gmail.com>
On Thu, Jan 7, 2010 at 4:16 PM, David Reitter <david.reitter@gmail.com> wrote:
Show 5 quoted lines
> I'm still unsure how, after the filter-branch, I would have some ancestor from the
> B series so that future pulls from the remote work, while having an ancestor from
> A, to make sure I can continue merging into C.  If history is rewritten, I'll get new
> revisions and lose ancestors.
> I'm beginning to thing that the cutting and pasting I'd like is conceptually impossible.

Hmm, this is pretty nasty. Essentially, you want your repo to include both sets of commits (so that it doesn't try to re-merge in the other commits later), but you don't want to *see* them in git log. Basically, you want git log to lie to you :)

Luckily, it already has this ability: it's called history simplification :)
Try this in your merged repo:
   git log .
(note the '.').

Without the dot, git log doesn't simplify any history, and you get every change. With the dot, it shows only commits that had a tangible effect on the file in question (in this case, the top directory, which includes *everything*). Thus, a "git merge -s ours" gets eliminated.

Beware that it might eliminate other equally non-impactful commits, however.
The same trick also works with gitk.
Have fun,
Avery
Previous: David Reitter
Message 6 of 6 in “merging two equivalent branches”
  1. David ReitterJan 7, 2010
  2. Christian MICHONJan 7, 2010
  3. git-log - hide parent (was: merging two equivalent branches)David Reitter, Jan 7, 2010
  4. Christian CouderJan 8, 2010
  5. David ReitterJan 12, 2010
  6. Avery PennarunJan 8, 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.