Skip to contentSkip to conversation

docs: Add a document on how to fix a messy diffstat

PATCH In review Jonathan Corbet 3 participants 3 messages Mar 29, 2022 – Mar 30, 2022

Subsystems (2)
lore
Share & tools
lore

Jonathan Corbet

author maintainer
#0 lore raw

PATCH v2 1/1 docs: Add a document on how to fix a messy diffstat

A branch with merges in will sometimes create a diffstat containing a lot of unrelated work at "git request-pull" time. Create a document based on Linus's advice (found in the links below) and add it to the maintainer manual in the hope of saving some wear on Linus's keyboard going forward.

---
v2: Various tweaks suggested by Borislav, Bagas, and Akira

 Documentation/maintainer/index.rst          |  1 +
 Documentation/maintainer/messy-diffstat.rst | 96 +++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 Documentation/maintainer/messy-diffstat.rst
Documentation/maintainer/index.rst +1 -0
index f0a60435b124..3e03283c144e 100644
@@ -12,6 +12,7 @@ additions to this manual.
    configure-git
    rebasing-and-merging
    pull-requests
+   messy-diffstat
    maintainer-entry-profile
    modifying-patches
 
Documentation/maintainer/messy-diffstat.rst new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
2.35.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Jonathan Corbet

A branch with merges in will sometimes create a diffstat containing a lot of unrelated work at "git request-pull" time. Create a document based on Linus's advice (found in the links below) and add it to the maintainer manual in the hope of saving some wear on Linus's keyboard going forward.

---
v2: Various tweaks suggested by Borislav, Bagas, and Akira

Thanks, Akira

Quoted 6 lines
 Documentation/maintainer/index.rst          |  1 +
 Documentation/maintainer/messy-diffstat.rst | 96 +++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 Documentation/maintainer/messy-diffstat.rst

[...]

Reviewed-by on v2 1/1
#2 lore raw
In reply to Jonathan Corbet
Quoted 12 lines · Jonathan Corbet
Documentation/maintainer/messy-diffstat.rst new file +12 -0
+So what is to be done?  The best response when confronted with this
+situation is to indeed to do a merge with the branch you intend your work
+to be pulled into, but to do it privately, as if it were the source of
+shame.  Create a new, throwaway branch and do the merge there::
+
+  ... vM --- vN-rc1 --- vN-rc2 --- vN-rc3 --- ... --- vN-rc7 --- vN
+                |         |                                      |
+                |         +-- c1 --- c2 --- ... --- cN           |
+                |                   /               |            |
+                +-- x1 --- x2 --- x3                +------------+-- TEMP
+
+The merge operation resolves all of the complications resulting from the

Documentation/maintainer/messy-diffstat.rst line 96

Quoted 10 lines
Documentation/maintainer/messy-diffstat.rst new file +10 -0
+multiple beginning points, yielding a coherent result that contains only
+the differences from the mainline branch.  Now it will be possible to
+generate a diffstat with the desired information::
+
+  $ git diff -C --stat --summary linus..TEMP
+
+Save the output from this command, then simply delete the TEMP branch;
+definitely do not expose it to the outside world.  Take the saved diffstat
+output and edit it into the messy pull request, yielding a result that
+shows what is really going on.  That request can then be sent upstream.

Looks OK.

Signature · 1 line
An old man doll... just what I always wanted! - Clara