From: Junio C Hamano <gitster@pobox.com>
To: Bruno Haible <bruno@clisp.org>
Cc: git@vger.kernel.org
Subject: Re: request for documentation about branch surgery
Date: Tue, 07 Jul 2009 08:52:16 -0700 [thread overview]
Message-ID: <7v3a98bidr.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <200907071213.25418.bruno@clisp.org> (Bruno Haible's message of "Tue\, 7 Jul 2009 12\:13\:24 +0200")
Bruno Haible <bruno@clisp.org> writes:
>> If you think "git merge" _copies_, you will never understand what "merge"
>> does. ... There is no copying involved anywhere . It only creates a new
>> commit
>
> There are two cases of "git merge" operation: the one that creates a diamond
> commit, and the one that doesn't (the "simple" case of "git merge"). The latter
> operation I found useful in achieving this surgery:
>
> C---D---E topic
> /
> A---B master
>
> =>
>
> C---D---E topic
> /
> A---B---C---D---E master
If C, D, E on the above two lines are the _same_ commit, i.e. with the
same history and same object IDs, then the picture should instead look
like this:
C---D---E topic
/
A---B master
=>
master
C---D---E topic
/
A---B master@{1}
If that is the case, you drew the picture incorrectly, and it shows the
misunderstanding of your git object model and what a git branch is.
The latter I have already explained to you, but here is a hint.
Do not think of a branch as "the upper line is topic, the lower line
is master". A branch is just a pointer to _a commit_. IOW, in the
picture I drew to correct yours, master and topic point at "E". It
does _not_ point at the line that C, D, and E are on. Similarly,
master@{1} points at the commit "B", not at the line A and B are on.
You claimed that you understand in your response, but judging from the way
you wrote the above picture, I can tell that you don't understand what a
branch in git is. Otherwise you would have drew it like how I did, and
you wouldn't have used the word "copy".
If you instead for some reason _want_ a forked history where C, D and E
are _duplicated_, then you would start from the first picture, fast
forward master to "E", and would force rebase onto B, to end up with
a picture like this.
C---D---E topic
/
A---B---C'--D'--E' master
But there is no reason to do this.
next prev parent reply other threads:[~2009-07-07 15:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-06 23:05 request for documentation about branch surgery Bruno Haible
2009-07-07 2:30 ` Elijah Newren
2009-07-07 3:45 ` Elijah Newren
2009-07-07 9:51 ` Bruno Haible
2009-07-07 10:06 ` Andreas Ericsson
2009-07-07 2:50 ` Junio C Hamano
2009-07-07 10:13 ` Bruno Haible
2009-07-07 11:03 ` Andreas Ericsson
2009-07-07 15:52 ` Junio C Hamano [this message]
2009-07-07 18:28 ` Daniel Barkalow
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=7v3a98bidr.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=bruno@clisp.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