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

Re: who's on first? - following first parent and merge-management

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Mar 8, 2012, 08:03 UTC
Message-ID
<4F5867D4.1010904@viscovery.net>
In-Reply-To
<20120308071403.GE7643@sigill.intra.peff.net>
Am 3/8/2012 8:14, schrieb Jeff King:
Show 13 quoted lines
> What if the user could specify a partial ordering of refs, and we used
> that order when listing merge parents in the resulting commit. So for
> example, if you said that:
> 
>   refs/remotes/origin/master > refs/heads/master
> 
> then doing:
> 
>   $ git checkout master
>   $ git pull origin master
> 
> would result in a "flipped" merge commit, with origin/master as the
> first parent, and master as the second.
I have wished for such a thing several times already.

It happens when I have a topic with changes that trigger a complete rebuild of the project. When I merge it to master, I have to

   # on topic
   git checkout master   #1
   git merge topic       #2

#1 triggers a rebuild, but I don't do a build. Then #2 again triggers a rebuild, but in reality the only changes since the last build are those from master since the topic forked (no, I can't use ccache).

To avoid the situation, I jump through hoops by preparing an index and worktree with the merge result while I am on topic:

   # on topic
   git checkout --detach
   git merge master      # triggers rebuild of only master's changes
   # merge result ready; carry it over to master and repeat the merge
   git reset --soft master
   git checkout master
   git merge topic       # fails if content merge is necessary
   git checkout master -- file/needing/content/merge # (*)
   git merge topic       # now succeeds

This would not be necessary if the order of the merge parents could be specified, e.g.:

   # on topic
   git merge --into master

(*) Jumping through these hoops make sense only if file/needing/content/merge is _not_ the one that triggers the complete rebuild.

-- Hannes
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 13 in “who's on first? - following first parent and merge-management”
  1. Neal KreitzingerMar 7, 2012
  2. Junio C HamanoMar 7, 2012
  3. Junio C HamanoMar 8, 2012
  4. Jeff KingMar 8, 2012
  5. Junio C HamanoMar 8, 2012
  6. Johannes SixtMar 8, 2012
  7. Junio C HamanoMar 8, 2012
  8. Holger HellmuthMar 9, 2012
  9. Johannes SixtMar 9, 2012
  10. Holger HellmuthMar 9, 2012
  11. Junio C HamanoMar 9, 2012
  12. Jonathan NiederMar 8, 2012
  13. Junio C HamanoMar 8, 2012

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.