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

Query on managing the order of commits in git merge

From
LCLinu Cherian <linuc.decode@gmail.com>
Date
Mar 23, 2021, 18:34 UTC
Message-ID
<CAAHhmWjLAO7EBEvcizFd1otDJDq8yesaA3FyDEYPWpuSLuy=Kw@mail.gmail.com>
Hi,
Had a query related to the order of commits in the command, git merge.
Lets say, we have a local branch(say A) tracking a remote upstream branch,.

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.

The query is, do we have control over in what order the patches gets merged into B. To be specific, is it possible to ensure that the local changes 5 & 6 is always on top of A, without affecting the commit ids(ie. case 2 above).

We are not considering the option of git rebase, since it alters the commit ids. Appreciate your thoughts on this.

Thanks.
Next: Junio C Hamano
Message 1 of 2 in “Query on managing the order of commits in git merge”
  1. Linu CherianMar 23, 2021
  2. Junio C HamanoMar 23, 2021

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.