What I am trying to do is to create a command-line tool to see which old branches (there can be a lot) don't have code differences to develop. right now I have to go to GitHub, do a pull request and select each branch to see if there are difference.
Rather than viewing the commits themselves, you can view the proposed changes as they'll appear in the files once the pull request is merged. The files appear in alphabetical order within the Files changed tab. Additions to the files appear in green and are prefaced by a + sign while content that has been removed appears in red and is prefaced by a - sign.
To simplify reviewing changes in a large pull request, you can filter the diff to only show selected file types, show files you are a CODEOWNER of, hide files you have already viewed, or hide deleted files. For more information, see "Filtering files in a pull request."
To see two committish references in a two-dot diff comparison on GitHub, you can edit the URL of your repository's "Comparing changes" page. For more information, see the Git Glossary for "committish" from the Pro Git book site.
If you want to simulate a two-dot diff in a pull request and see a comparison between the most recent versions of each branch, you can merge the base branch into your topic branch, which updates the last common ancestor between your branches.
When you use a two-dot comparison, the diff changes when the base branch is updated, even if you haven't made any changes to the topic branch. Additionally, a two-dot comparison focuses on the base branch. This means that anything you add is displayed as missing from the base branch, as if it was a deletion, and vice versa. As a result, the changes the topic branch introduces become ambiguous.
To avoid getting confused, merge the base branch (for example, main) into your topic branch frequently. By merging the base branch, the diffs shown by two-dot and three-dot comparisons are the same. We recommend merging a pull request as soon as possible. This encourages contributors to make pull requests smaller, which is recommended in general.
This has been useful in the context of long-running pull requests to see just a subset of the changes. But there has been a big problem with this view: you cannot comment on such a compare view like you can on a pull request diff.
Over the past year or so the performance of the Bitbucket Cloud pull request screen has noticeably degraded. I have received numerous reports from developers in my organization of the pull request diff panel timing out before the diff is loaded. Sometimes a manual refresh can fix this issue, but at other times multiple attempts to load the pull request screen will fail. The error that appears on screen says,
However, the repo is what it is, and we would not want to consider truncating our history just to resolve a technical issue on Bitbucket's side. The pull request interface's performance under these conditions is unacceptable, and fueling discussion of leaving Bitbucket for GitHub. If there is anything Atlassian can do to improve performance, I would rather stay than migrate and undertake the headache that goes with that. But we can't stay if it continues to behave this way.
The loss of merge preview from this change has been a problem for us, it would be better if we had the option between 2-way and 3-way diff (for smaller repos the performance benefit of 2-way diff is not useful, and so the advantage of 3-way diff is much better). I also don't think the rebase solution mentioned here works in all scenarios (e.g. when repeatedly merging a feature branch into a development branch, where the development branch also contains commits from other WIP features). @Norbert C is there any good way around this issue, or is it possible to re-enable 3-way diffs for us repo owners who would prefer it?
Not too long ago we introduced Pipe it Down, a Chrome extension to help dealwith GitHub pull request diffs with lots of files. The major pain point itaddresses for us is dealing with large files automatically generated by Unity.These files rarely get reviewed by a human, but we had to scan through themanyway in order to get to the source files we care about. Being able to collapsethose files has helped tremendously.
By contrast, if you only worked from master, you only have to do a git pull --rebase and you get to skip the cascading rebases, every time. You get to do just the work that you care about. All the branch jumping falls away without any cost. Might seem minor, but if you do the math on how often you have to do this, it adds up.
In this case, when different reviewers request changes to the code for theses V and W, you just slap commits Y++ and Y++++ onto the end of the Pull Request to address the feedback across all of the commits. This means that the coherence of codebase goes down over time.
Suhair starts the day fixing a bug. Creates a branch, makes changes. Commits them. Suhair then pushes to the remote branch. Then navigates away from the terminal to the Github UI to create a pull request.
Next, Suhair switches back to master, pulls, and creates a new branch to work on a new feature. Commits code. This code is completely unrelated to the bug fix. In fact, they would never generate merge conflicts. Still, Suhair sticks to branches. Works on the feature. Gets it to a good RFC state. Suhair pushes the changes. In Github, Suhair creates a pull request.
Suhair pulls master in the morning to get the latest changes. Makes the first bug fix, commits it, creates a Diff to be reviewed, entirely from the command line. Suhair then works on the unrelated feature. Commits. Creates a Diff from the command line. Then starts working on the bug-fix-dependent feature improvement. Because Suhair never left master, the bug fix is still in the stack. So, Suhair can proceed with the feature improvement uninterrupted. So, Suhair does the work. Commits it. Creates a Diff for review.
The most common approach for productive engineers is #2. Sure, it involves a little more context switching, but it beats waiting and doing nothing, right? So a typical flow when working on several pull requests is:
One of my biggest personal \u201Cwow\u201D moments during my time at Uber as a developer, was when I began using stacked diffs. Stacking refers to breaking down a pull request (PR) for a feature into several, smaller PRs which all depend on each other \u2013 hence the term \u201Cstacked\u201D. It might sound counterintuitive, but this workflow is incredibly efficient by making it easier to review and modify PRs \u2013 or \u201Cdiffs\u201D as we called them at Uber.
\u2018Once the PR is merged, you want to start work on the next feature. So you branch off of main again and begin building. Even at its most seamless, this process takes a long time! The biggest time waster is that PRs sit waiting for review for hours or days. We analyzed historical data for 15 million pull requests and PRs exist which waited several years to be merged!
\u2018Stacking makes the unit of change an individual commit, rather than a pull request composed of several commits. With stacking, you break up larger changes into many smaller ones. This change \u2013 a commit! \u2013 can be tested, reviewed, landed, and reverted individually.
But this \u201Ctraditional\u201D pull request flow doesn\u2019t work well when PRs depend on one another. So long as PRs are completely independent, the classic flow works well enough, and you just switch between different branches, locally.
The idea behind stacked diffs is that you can keep working on your main branch, and worry about reviews later. You check out the main branch and start working on it, make a small change, and commit this as a diff \u2013 a very small pull request. You then continue working, creating a second diff, and a third, and so on.
It might feel like a small change to keep working on your current branch without waiting on reviews. But this adds up to a massive productivity boost when working with small diffs and small pull requests. Let\u2019s visualize the difference:
Most developers work on large and complex pieces of work, and because of this complexity, it is not reasonable to ask engineers to limit a pull request to, say, 200 changed lines at most. Sometimes one, complete piece of work can be as many as hundreds \u2013 or even thousands! \u2013 of lines long.
In theory, stacked diffs seem like a pleasant workflow. However, things get a bit more complicated when a change is made on the main branch or in an earlier diff. Let\u2019s take the latter case, when a reviewer requests significant changes to the first diff.
Every comment consumes WTD tokens from your account when using What The Diff. A huge pull request consumes more tokens than a small one, so working with smaller PRs gives you a better overview of your changes and more detailed descriptions by the AI.
We've built granular controls for your account so that you get most of your free and paid tokens. We recommend ignoring pull requests by CI services as well as draft PRs and make it possible to exclude files that aren't interesting to you.
Automate the generation of Simulink model diffs for GitHub pull requests and push events using GitHub Actions. Automatically attach the comparison reports to the pull request or push event for easy viewing outside of MATLAB and Simulink. Watch Simulink Model Comparison for GitHub Pull Requests (4min 46sec).
The actions, defined in the Diff_runTests_push.yml and Diff_runTests_pullrequest.yml files, use a self-hosted runner. Using a self-hosted runner enables you to keep your repository private. To add a self-hosted runner to your repository, follow the instructions at -your-own-runners.
df19127ead