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

How to merge branches except for one commit

From
Andrew Arnott <andrewarnott@gmail.com>
Date
May 29, 2008, 02:32 UTC
Message-ID
<216e54900805281932v1397fd30sad91f767175ba95e@mail.gmail.com>
Hi helpful git users!

I have a pattern for work (which may be flawed--feel free to jab it) that leads me to a difficult maintenance story:

Work on master..., tracked source code set to v1.0 Create branch v1.0.... tag v1.0.0 On master, increment version of library in source code to v2.0 More work on master... Cherry-pick most of the commits on master to the v1.0 branch, leaving off the commit that changed master's version number to v2.0 Tag v1.1. Work on master continues toward v2.0... Branch off v2.0... (and the pattern continues, with some commits in master getting back-ported to maintenance branches.

At some point, most or all the commits on master since branching off v1.0 I want to include in the v1.1 release. When I want to include all the commits from master in the v1.0 branch I just do: git checkout v1.0 git merge master ...and life is good because gitk history makes the merge easy to see and individual commits can be easily identified as belonging to both master and v1.0. But as soon as I branch off v1.0 I want my master branch to start building as v2.0, which means the first commit after branching should never be included in the v1.0 branch. As I understand it, that rules out ever using "git merge". I believe the only option that leaves me is cherry picking individual commits, which is a maintenance pain because each commit then appears as many times as branches it belongs to, and it's difficult given just one commit to tell which branches it has been ported to.

Am I doing something wrong, un-knowledgeable of how to properly do merges/cherry-picks, or is this just life as we know it?

Thanks. -- Andrew Arnott

Next: Avery Pennarun
Message 1 of 7 in “How to merge branches except for one commit”
  1. Andrew ArnottMay 29, 2008
  2. Avery PennarunMay 29, 2008
  3. Andrew ArnottMay 29, 2008
  4. Andreas EricssonMay 29, 2008
  5. Junio C HamanoMay 29, 2008
  6. Imran M YousufMay 29, 2008
  7. Andrew ArnottMay 29, 2008

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.