@@ -658,16 +658,23 @@ gitlink:git-diff[1]:
658658$ git diff master..test
659659-------------------------------------------------
660660
661- Sometimes what you want instead is a set of patches:
661+ That will produce the diff between the tips of the two branches. If
662+ you'd prefer to find the diff from their common ancestor to test, you
663+ can use three dots instead of two:
664+
665+ -------------------------------------------------
666+ $ git diff master...test
667+ -------------------------------------------------
668+
669+ Sometimes what you want instead is a set of patches; for this you can
670+ use gitlink:git-format-patch[1]:
662671
663672-------------------------------------------------
664673$ git format-patch master..test
665674-------------------------------------------------
666675
667676will generate a file with a patch for each commit reachable from test
668- but not from master. Note that if master also has commits which are
669- not reachable from test, then the combined result of these patches
670- will not be the same as the diff produced by the git-diff example.
677+ but not from master.
671678
672679[[viewing-old-file-versions]]
673680Viewing old file versions
@@ -2554,6 +2561,72 @@ branches into their own work.
25542561For true distributed development that supports proper merging,
25552562published branches should never be rewritten.
25562563
2564+ [[bisect-merges]]
2565+ Why bisecting merge commits can be harder than bisecting linear history
2566+ -----------------------------------------------------------------------
2567+
2568+ The gitlink:git-bisect[1] command correctly handles history that
2569+ includes merge commits. However, when the commit that it finds is a
2570+ merge commit, the user may need to work harder than usual to figure out
2571+ why that commit introduced a problem.
2572+
2573+ Imagine this history:
2574+
2575+ ................................................
2576+ ---Z---o---X---...---o---A---C---D
2577+ \ /
2578+ o---o---Y---...---o---B
2579+ ................................................
2580+
2581+ Suppose that on the upper line of development, the meaning of one
2582+ of the functions that exists at Z is changed at commit X. The
2583+ commits from Z leading to A change both the function's
2584+ implementation and all calling sites that exist at Z, as well
2585+ as new calling sites they add, to be consistent. There is no
2586+ bug at A.
2587+
2588+ Suppose that in the meantime on the lower line of development somebody
2589+ adds a new calling site for that function at commit Y. The
2590+ commits from Z leading to B all assume the old semantics of that
2591+ function and the callers and the callee are consistent with each
2592+ other. There is no bug at B, either.
2593+
2594+ Suppose further that the two development lines merge cleanly at C,
2595+ so no conflict resolution is required.
2596+
2597+ Nevertheless, the code at C is broken, because the callers added
2598+ on the lower line of development have not been converted to the new
2599+ semantics introduced on the upper line of development. So if all
2600+ you know is that D is bad, that Z is good, and that
2601+ gitlink:git-bisect[1] identifies C as the culprit, how will you
2602+ figure out that the problem is due to this change in semantics?
2603+
2604+ When the result of a git-bisect is a non-merge commit, you should
2605+ normally be able to discover the problem by examining just that commit.
2606+ Developers can make this easy by breaking their changes into small
2607+ self-contained commits. That won't help in the case above, however,
2608+ because the problem isn't obvious from examination of any single
2609+ commit; instead, a global view of the development is required. To
2610+ make matters worse, the change in semantics in the problematic
2611+ function may be just one small part of the changes in the upper
2612+ line of development.
2613+
2614+ On the other hand, if instead of merging at C you had rebased the
2615+ history between Z to B on top of A, you would have gotten this
2616+ linear history:
2617+
2618+ ................................................................
2619+ ---Z---o---X--...---o---A---o---o---Y*--...---o---B*--D*
2620+ ................................................................
2621+
2622+ Bisecting between Z and D* would hit a single culprit commit Y*,
2623+ and understanding why Y* was broken would probably be easier.
2624+
2625+ Partly for this reason, many experienced git users, even when
2626+ working on an otherwise merge-heavy project, keep the history
2627+ linear by rebasing against the latest upstream version before
2628+ publishing.
2629+
25572630[[advanced-branch-management]]
25582631Advanced branch management
25592632==========================
0 commit comments