git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Git Mailing List <git@vger.kernel.org>
Subject: The coolest merge EVER!
Date: Wed, 22 Jun 2005 14:46:51 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0506221433540.2353@ppc970.osdl.org> (raw)


Ok, Junio had some cool octopus merges, but I just one-upped him.

I just merged the "gitk" repository into git, and I did it as a real git
merge, which means that I actually retained all the original gitk
repository information intact. IOW, it's not a "import the data" thing,
it's literally a merge of the two trees, and the result has two roots.

Now, the advantage of this kind of merge is that Paul's original gitk
repository is totally unaffected by it, yet because I now have his history
(and the exact same objects), the normal kind of git merge should work
fine for me to continue to import Paul's work - we have the common parent
needed to resolve all differences.

Now, I don't know how often this ends up being actually used in practice, 
but at least in theory this is a totally generic thing, where you create a 
"union" of two git trees. I did the union merge manually, but in theory it 
should be easy to automate, with simply something like

	git fetch <project-to-union-merge>
	GIT_INDEX_FILE=.git/tmp-index git-read-tree FETCH_HEAD
	GIT_INDEX_FILE=.git/tmp-index git-checkout-cache -a -u
	git-update-cache --add -- (GIT_INDEX_FILE=.git/tmp-index git-ls-files)
	cp .git/FETCH_HEAD .git/MERGE_HEAD
	git commit

(this is not exactly how I did it, but that's just because I'd never done
this before so I didn't think it through and I had some stupid extra steps
in between that were unnecessary).

Of course, in order for the union merge to work, the namespaces have to be
fit on top of each other with no clashes, otherwise future merges will be 
quite painful. In the case of gitk, Paul's repository only tracked that 
single file, so that wasn't a problem.

Anyway, you shouldn't notice anything new, except for the fact that "gitk" 
now gets automatically included with the base git distribution. And the 
git repository has two roots, but hey, git itself doesn't care.

			Linus

             reply	other threads:[~2005-06-22 21:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-22 21:46 Linus Torvalds [this message]
2005-06-23  0:12 ` The coolest merge EVER! Jon Seymour
2005-06-23  0:24   ` Jeff Garzik
2005-06-24  0:44 ` Junio C Hamano
2005-06-24 11:54   ` Matthias Urlichs
2005-06-24 17:49     ` Daniel Barkalow
2005-06-24 19:22     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0506221433540.2353@ppc970.osdl.org \
    --to=torvalds@osdl.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).