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

Re: Cherry picking instead of merges.

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 4, 2008, 16:47 UTC
Message-ID
<alpine.LFD.1.10.0807040939150.2815@woody.linux-foundation.org>
In-Reply-To
<486DC4F2.70608@viscovery.net>
On Fri, 4 Jul 2008, Johannes Sixt wrote:
Show 6 quoted lines
> 
> FWIW, the same thing in different words is written in section
> 
> "Why bisecting merge commits can be harder than bisecting linear history"
> 
> of Documentation/user-manual.txt.
I don't think that's the same thign at all.

That section basically says "just keep things linear". Which I very much disagree with. Trying to keep things linear just doesn't work if you work together with other people - since you have to rewrite history.

So my argument was the exact _reverse_. Don't try to keep things linear, because it doesn't _work_ right. Do the merges. They will very seldom cause subtle merge problems (non-subtle ones are much more common, but trivial to handle), and they will mean that you can work effectively togethr with other people.

And then, _if_ you have a merge that you really cannot figure out why it breaks, at that point you can _temporarily_ linearize the git history after-the-fact just as easily as you would ever have done before-the-fact.

In other words: linearization throws away real and useful information. You can always linearize afterwards for bisection purposes or whatever, but you can never _un_linearize because you've thrown away the information.

So it's much better to just do merges and keep the history, and then there are ways to rewrite the history later if you really need it.

That said - I think it's good practice and perfectly sane to do things like git-rebase to rewrite the history in a _private_ tree that contains only your own modifications and has never been public (where "applied emailed patches from others" still counts as your own work).

The "don't linearize" mantra really only is about commits that have ever been in anybody elses repository (and whether they _came_ from there, or whether they came from you but were public to others is immaterial).

			Linus
Previous: Johannes SixtNext: Linus Torvalds
Message 12 of 13 in “Cherry picking instead of merges.”
  1. David BrownJul 3, 2008
  2. Alex RiesenJul 3, 2008
  3. Avery PennarunJul 3, 2008
  4. David BrownJul 3, 2008
  5. Samuel TardieuJul 3, 2008
  6. Linus TorvaldsJul 3, 2008
  7. David BrownJul 3, 2008
  8. Björn SteinbrinkJul 4, 2008
  9. David BrownJul 4, 2008
  10. Linus TorvaldsJul 4, 2008
  11. Johannes SixtJul 4, 2008
  12. Linus TorvaldsJul 4, 2008
  13. Linus TorvaldsJul 4, 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.