LWN: Comments on "Handling messy pull-request diffstats" https://lwn.net/Articles/889760/ This is a special feed containing comments posted to the individual LWN article titled "Handling messy pull-request diffstats". en-us Tue, 07 Oct 2025 11:16:28 +0000 Tue, 07 Oct 2025 11:16:28 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Handling messy pull-request diffstats https://lwn.net/Articles/893980/ https://lwn.net/Articles/893980/ geert <div class="FormattedComment"> Because Linus does not like receiving pull requests for branches that have been rebased recently, as that invalidates any testing done on the pre-rebased branch.<br> <p> It&#x27;s still a good idea to maintain your own separate rebased branch for cross-checking: merging in a branch, and rebasing your own work on top of that branch should yield the exact same tree.<br> </div> Thu, 05 May 2022 08:28:26 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/893979/ https://lwn.net/Articles/893979/ jepsis <div class="FormattedComment"> Why not just maintain a separate rebased branch and send a pull request from there?<br> </div> Thu, 05 May 2022 07:50:34 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892506/ https://lwn.net/Articles/892506/ k3ninho <div class="FormattedComment"> The tooling isn&#x27;t matched to the &#x27;send a patch&#x27; workflow of the mailing list -- a merge request wants patch-equivalent state that would apply cleanly like a good happy patch should. That said, it&#x27;s weird this is a &#x27;trick&#x27; given it&#x27;s how I&#x27;ve come to use git for pull-request mediated development.<br> <p> Maybe there should be a more-automated way to avoid suggesting things are in conflict for files you didn&#x27;t edit -- the ones that change due to the repository changing around you -- but that doesn&#x27;t give a hint as to the importance of changes when you merge a second branch to your non-trunk working set.<br> <p> K3n.<br> </div> Mon, 25 Apr 2022 11:06:51 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892448/ https://lwn.net/Articles/892448/ olof <div class="FormattedComment"> We&#x27;ve done this for the (ARM) SoC trees almost since the start, due to the complex merge history.<br> <p> The normal flow I used was to remove any rerere cache, merge each branch one by one into current HEAD of Linus&#x27; tree, writing down any conflict resolution, and then generate the pull requests with a local script that did the diffstat (and log) manually. Worked well for 10+ years so far, with a few manual hiccups when I diff the wrong merge vs git tag.<br> <p> </div> Sat, 23 Apr 2022 21:11:30 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892441/ https://lwn.net/Articles/892441/ pm215 <div class="FormattedComment"> I tend to feel like if this complicated explanation and tricks like &quot;do a merge purely to create a diffstat, then throw it away&quot; are necessary, then there&#x27;s a problem with either the workflow or with the tooling&#x27;s ability to support that workflow...<br> <p> </div> Sat, 23 Apr 2022 16:40:47 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892435/ https://lwn.net/Articles/892435/ mathstuf <div class="FormattedComment"> `rerere` doesn&#x27;t use the object store (for better or worse). My issue tends to be messing up a resolution and having to remove it. But it&#x27;s just easier to nuke them all than to figure out which one it is once you have a collection amassed. If they were stored with the other objects, they&#x27;d need some more tooling to clean them out more effectively.<br> </div> Sat, 23 Apr 2022 11:22:52 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892401/ https://lwn.net/Articles/892401/ NYKevin <div class="FormattedComment"> <font class="QuotedText">&gt; since the work of conflict resolution has been done once and should not be wasted.</font><br> <p> Strictly speaking, you don&#x27;t need to keep the temp branch around even for the purpose of saving yourself work. You can just use git rerere for that. I would tend to assume there is a reasonable way of exporting the rerere metadata so that you can share it with others, but cursory Googling only turns up weird ideas like &quot;make a dedicated branch,&quot; and I have no idea why that should be necessary or useful for pulling already-existing data out of .git.<br> </div> Sat, 23 Apr 2022 00:27:39 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892393/ https://lwn.net/Articles/892393/ jgg <div class="FormattedComment"> I&#x27;ve been doing this for years.. The other twist Linus shared with me is to actually keep the merged branch in some cases and send it as a &#x27;FYI here is my merge resolution&#x27;. I do this when there are conflicts, I&#x27;ll send the conflict resolution in the pull request and also mention that I have done it in the for-linus-merged tag. Linus says he will pull and compare the for-linus-merged as a sanity check (or perhaps use it sometimes)<br> <p> This is an example: <br> <p> <a href="https://lore.kernel.org/linux-rdma/20210901234159.GA2421971@nvidia.com/">https://lore.kernel.org/linux-rdma/20210901234159.GA24219...</a><br> <p> (and look at the bottom my script that sorts this out puts a note about the diffstat)<br> </div> Fri, 22 Apr 2022 22:52:24 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892399/ https://lwn.net/Articles/892399/ pbonzini <div class="FormattedComment"> <font class="QuotedText">&gt; resolving conflicts is the judgement of the maintainer who accepts the merge request:</font><br> <p> Resolving conflicts in Linux is done earlier, using common topic branches that are included by multiple maintainers (or that the maintainers includes in both the for-rcN and the for-next branches).<br> <p> If the conflicts are not caught earlier, Linus absolutely doesn&#x27;t care if he has conflicts to solve, in fact he wants to see them because it&#x27;s his way of detecting places that are not collaborating well or that could be messy during the -rc phase.<br> <p> Looks like material for a second article... :)<br> </div> Fri, 22 Apr 2022 22:40:29 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892397/ https://lwn.net/Articles/892397/ mathstuf <div class="FormattedComment"> <font class="QuotedText">&gt; And yet, merging master (or whatever upstream) into your development branch seems to be frowned on by Linus and other guardians of git workflow.</font><br> <p> Yes, I agree. It puts your target on the non-first parent path which &quot;twists&quot; the DAG a bit in most renderings. What you can do instead is make a new branch off of the target rc and merge your proposal into it and then submit that with conflicts resolved. This makes it look like `c2` in the later build graphs in the article (which is fine).<br> </div> Fri, 22 Apr 2022 21:43:14 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892395/ https://lwn.net/Articles/892395/ epa <div class="FormattedComment"> If there are merge conflicts then when the pull request is finally accepted they will have to be resolved too. That suggests submitting this ‘temp’ branch as the branch to be merged, since the work of conflict resolution has been done once and should not be wasted. That also seems cleaner than using one branch just to fake up a diffstat while what’s actually merged is something else. <br> <p> And yet, merging master (or whatever upstream) into your development branch seems to be frowned on by Linus and other guardians of git workflow. It does make the final graph more tangled. And you could argue that resolving conflicts is the judgement of the maintainer who accepts the merge request: you don’t necessarily trust some contributor to handle conflicts correctly even if you would be prepared to review and merge code they wrote. <br> <p> So is there a way git could deal with this? Like a ‘merge but not merge’? If there are any conflicts you have to resolve them, and the way you did it is recorded somehow, but the final content remains unchanged. This ‘prepared to merge’ branch could then be submitted as a merge request, and the maintainer could choose to stick with the conflict resolution you did, or ignore it and resolve from scratch. <br> <p> I guess in some muddled way I am analogizing to ‘prepare to commit’ in database systems, where any data conflicts are checked now, so if the next operation is a commit it is guaranteed to succeed. <br> </div> Fri, 22 Apr 2022 21:19:27 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892391/ https://lwn.net/Articles/892391/ pbonzini <div class="FormattedComment"> Mostly because there can be conflicts and in that case it is not possible to do it automatically.<br> <p> And since all maintainers should be doing a test merge (to check for conflicts, especially the rare semantic ones that cause the build to fail and Linus to shout...) before sending a pull request, you already have the test branch ready and can use it to create the diffstat.<br> <p> It&#x27;s true though that, assuming you have the test branch ready, it may make sense for git-request-pull to have an option that uses it.<br> <p> (FWIW this was one of the most confusing things to learn when I started maintaining KVM...)<br> </div> Fri, 22 Apr 2022 19:46:42 +0000 Handling messy pull-request diffstats https://lwn.net/Articles/892388/ https://lwn.net/Articles/892388/ khim This sounds like a suspiciously simple algorithm. Why can't Git do that automatically? Fri, 22 Apr 2022 18:39:42 +0000