From: Moritz Neeb <lists@moritzneeb.de>
To: Seb <spluque@gmail.com>, git@vger.kernel.org
Subject: Re: interactive rebase results across shared histories
Date: Sun, 21 Feb 2016 03:12:49 +0100 [thread overview]
Message-ID: <56C91D21.90306@moritzneeb.de> (raw)
In-Reply-To: <87io1j6laz.fsf@gmail.com>
Hi Seb,
On 02/20/2016 11:58 PM, Seb wrote:
> Hello,
>
> I've recently learnt how to consolidate and clean up the master branch's
> commit history. I've squashed/fixuped many commits thinking these would
> propagate to the children branches with whom it shares the earlier parts
> of the its history. However, this is not the case; switching to the
> child branch still shows the non-rebased (dirty) commit history from
> master. Am I misunderstanding something with this?
I am not sure what you meand by "child branch". If I understand
corretly, you have something like:
A---B---C topic
/
D---E---F---G master
then you merge the topic:
A---B---C topic
/ \
D---E---F---G---H master
and then you do something like "git rebase -i E" to linearize history
and maybe squash some commits, to result in something like:
D---E---F---G---AB'---C' master
Where AB' is a squashed commit containing the changes from A and B.
Now, your misunderstanding may be in the fact of "what happened to the
topic branch?". Because looking at the whole graph, you have something
like this:
A---B---C topic
/
D---E---F---G---AB'---C' master
where it is important to note, that the topic still points to C. Which
is totally correct, because you did not say anything about topic after
the merge. If you wanted to continue working on the topic branch, then
maybe a non-interactive rebasing, like described in the rebase manpage
would be something you might want to do before rebasing. E.g., from the
start doing "git rebase master topic" leads to:
A'--B'--C' topic
/
D---E---F---G master
and then you could squash your commits as you like with "git rebase -i G":
AB'--C' topic
/
D---E---F---G master
and maybe fast-forward merging master with "git merge master", then you
have both branches pointing to C':
D---E---F---G---AB'--C' topic,master
The same could've been reached in one step via "git rebase -i master topic".
Maybe, to get a better understanding, you could use visualization tool
like "tig" or "gitk" to observe what happens to your commits (hashes)
and branches (labels) and just play around with some of these operations.
next prev parent reply other threads:[~2016-02-21 2:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-20 22:58 interactive rebase results across shared histories Seb
2016-02-21 2:12 ` Moritz Neeb [this message]
2016-02-21 17:25 ` Seb
2016-02-21 19:08 ` Eric Sunshine
2016-02-22 3:32 ` Seb
2016-02-22 7:41 ` David
2016-02-23 17:39 ` Seb
2016-02-23 22:57 ` Moritz Neeb
2016-02-23 23:04 ` Kevin Daudt
2016-02-23 23:05 ` Seb
2016-02-26 12:38 ` David
2016-02-26 21:12 ` Seb
2016-02-26 22:56 ` Stepan Kasal
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=56C91D21.90306@moritzneeb.de \
--to=lists@moritzneeb.de \
--cc=git@vger.kernel.org \
--cc=spluque@gmail.com \
/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).