git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Linu Cherian <linuc.decode@gmail.com>
Cc: git@vger.kernel.org, Linu Cherian <lcherian@marvell.com>
Subject: Re: Query on managing the order of commits in git merge
Date: Tue, 23 Mar 2021 12:04:08 -0700	[thread overview]
Message-ID: <xmqqft0l3d5j.fsf@gitster.g> (raw)
In-Reply-To: <CAAHhmWjLAO7EBEvcizFd1otDJDq8yesaA3FyDEYPWpuSLuy=Kw@mail.gmail.com> (Linu Cherian's message of "Wed, 24 Mar 2021 00:04:49 +0530")

Linu Cherian <linuc.decode@gmail.com> writes:

> A has the following commits,
> A ---> 1---2---3--4
>
> We do have another branch B, which is forked out of A and our
> features/fixes has been added
> on top of A.
> B ---->1 --2--3--4--5--6
>
>
> At a later stage, we sync branch A to the remote upstream branch
> and it becomes,
> A --> 1--2--3--4--7--8
>
> Now, when we merge A to B, the order in which the commits are merged
> into can be different based on date of commit. CMIIW
>
> Like, case 1:
>
> B --> 1--2--3--4--5--6--7--8--M
>
> case 2:
>
> B-->1--2--3--4--7--8--5--6--M
>
> where M is the merge commit.

Neither is showing you made a merge.  If you try gitk (or "git log
--oneline --graph"), you'll see that a merge does not result in a
single strand of pearls like the above.

I think your merge is working perfectly correctly, without
butchering the order each branch had its commits, and adding a
single merge commit 'M' that is a child of the commits at the tip of
these two branches.  It's just the order of commits you see when you
tell the tool to show them linearly (e.g. "log" without "--graph").

There are "--topo-order" etc. options that you can influence the
display order of the "log" output.



      reply	other threads:[~2021-03-23 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 18:34 Query on managing the order of commits in git merge Linu Cherian
2021-03-23 19:04 ` Junio C Hamano [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqft0l3d5j.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linuc.decode@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).