43

This happens to me both with Compare view as well as standard commits that are large in the amount of files changed.

The screenshot below is from a compare between two branches with 380 files changed. The files at the beginning of the diff log have their diffs visualized but at a certain point down the page it stops visualizing the diffs. I understand you don't want massive pages but I can't seem to find a way to view a file's diff individually. Instead I have to check these both out locally and do the diff manually.

Does anyone have a simpler solution whether it be software driven or (preferably) a link i'm missing on github?

Diff screenshot

ryan
  • 6,541
  • 5
  • 43
  • 68
  • Can you say a bit more about what repos you're looking at or why this has to be through github? As a DVCS, usually anyone interested in a git repo already has the whole repo cloned--and it's easy to get arbitrary diffs at that point. – blahdiblah Mar 16 '12 at 20:24
  • Sharing the diff with someone that doesn't have the repo or any git tools installed. Would be a lot easier to send them the URL than prepare a diff and format it. – ryan Mar 19 '12 at 12:52
  • I don't know how long this has been possible, but you can now store Javascript directly into Chrome and other browser bookmarks to run whenever you click the "bookmark". These are called "bookmarklets", because they are Javascript applets stored inside bookmarks. Here's a bookmarklet in my new answer here to show all files during a GitHub PR review: https://stackoverflow.com/a/64269165/4561887. – Gabriel Staples Oct 08 '20 at 19:11

7 Answers7

72

Adding .patch to the end of the URL somewhat helps. Removes the nice UI and comment functionality, of course.

An example. If your pull request is: https://github.com/JustinTulloss/zeromq.node/pull/47, then the patch can be found at https://github.com/JustinTulloss/zeromq.node/pull/47.patch

OtherDevOpsGene
  • 7,302
  • 2
  • 31
  • 46
Simon Lindholm
  • 2,266
  • 1
  • 21
  • 12
  • 7
    This comment deserves more attention. Adding .patch into the URL allows you to see the changes in the files without having to download a local diff. – CrimsonX Jan 06 '15 at 16:13
  • @CrimsonX : which URL? I can't find an URL working with .patch added. – FBB Apr 13 '15 at 19:55
  • 1
    E.g. https://github.com/simonlindholm/dotfiles/commit/ad9102462076b159a8e344f4a202dfb024c18ef4.patch. Compare views also work. – Simon Lindholm Apr 15 '15 at 23:49
  • 2
    An example. If your pull request is: `https://github.com/JustinTulloss/zeromq.node/pull/47`, then the patch can be found at `https://github.com/JustinTulloss/zeromq.node/pull/47.patch` – Josh Oct 07 '15 at 18:17
  • 1
    Note: GitHub now does a redirect to the `.patch` URL. So if using a command such as `curl` do `curl -L https://github.com/`. – Trevor Norris Dec 23 '15 at 20:17
  • This also works for the branch comparison view, before actually creating the PR. – Zefiro Nov 15 '17 at 15:25
  • Excellent response, this is working for my 10500 changed lines – JeanCarlos Chavarria Sep 25 '19 at 19:06
36

Official support answer as of Feb 19th / 2013 via Brian Levin @github.

We have some limits on diffs that we show in the browser in order to keep the pull request and compare pages working. Currently, we cut them off at 300 files, a total diff of 1MB, and an individual diff of 100KB.

If your diffs exceed the limits and can't be viewed online, you can always pull the changes locally and view the diff there. It may not be as convenient for you, but it'll get the job done.

sjakubowski
  • 2,913
  • 28
  • 36
7

I had the same issue. If you want to stick with the browser experience I've found the following solution:

Open your JavaScript console and execute:

document.querySelectorAll('button.load-diff-button').forEach(button => button.click());

This will freeze the page since all click events are fired at the same time. Have some patience and everything will be loaded. Obviously if the document structure changes one might need to update the above statement.

3limin4t0r
  • 19,353
  • 2
  • 31
  • 52
5

This sounds like a bug on github. But you could see similar statistics using git diff on the command-line. And if you really want a graphical tool, perhaps installing something like meld would help.

git config --global diff.tool meld
git difftool master..devel
idlethread
  • 1,111
  • 7
  • 16
  • Another way is to use Apple's built-in [FileMerge](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/opendiff.1.html) utility via ```git config --global diff.tool opendiff``` – Denis Malinovsky Feb 26 '16 at 17:32
1

The best local comparison I've found to use is to use IntelliJ's built in comparison. Adding comments is a pain, but everything else works well. Perform the following steps:

  1. Identify the file you're interested in, say "myClass.java"
  2. Pull the latest from your develop and your branch, call it compare_branch
  3. checkout the latest by git checkout compare_branch
  4. Open IntelliJ, and use double-shift completion to search for the file you need to look at, e.g. shift-shift myclass.java to navigate to it.
  5. In IntelliJ's menu, select VCS -> Git -> Compare with branch -> develop replace develop with whatever you want to compare against.

Hope this helps someone else.

CrimsonX
  • 9,048
  • 9
  • 41
  • 52
0

If you know which file or directory you want, you can use the GitHub File Diff extension, available for Chrome and Firefox.

Disclaimer: I made this extension.

mohd.akram
  • 121
  • 2
  • 3
0

Create a bookmarklet called "Load all diffs". Click it to show all changed files on a GitHub PR.

Does anyone have a simpler solution whether it be software driven or (preferably) a link i'm missing on github?

From my GitHub gist here:

(credit goes to @Juanca from their gist here)

Instructions:

Create these bookmarks in your browser with the following Name and URL fields. For the URL field, just copy and paste the code block exactly as written, line breaks and all, including the javascript: line at the top! Line breaks, whitespace, and multi-line C-style comments (ex: /* comment */) are all permitted (tested in Chrome at least) when copy-pasting into the URL field to create a bookmarklet. Once you've created a browser bookmark with this code in it, then put it in your bookmarks bar at the top of your browser, and click on them when needed to run the specified Javascript program to perform the prescribed function.

  1. When viewing the "Files changed" tab during a GitHub PR review, some files with many changes may be collapsed. GitHub shows a "Load diff" link for these files, and says in small font underneath this link: "Large diffs are not rendered by default.". This makes it impossible to use Ctrl + F to search the page for certain code or text within those files, and it can be tedious to manually scroll down and click the "Load diff" link one-at-a-time for each of those files. So, click your "Load all diffs" bookmarklet below to quickly show (load) the diffs for all files.

    Name: "Load all diffs"

    URL:

    javascript:
    
    /*
    Load all diffs by expanding all files in the "Files changed" tab during a GitHub PR 
    review.
    Source: https://gist.github.com/juanca/5fd799c5b094e3e4f8b709cd101d7403
    */
    
    document.querySelectorAll('.load-diff-button').forEach(node => node.click())
    

Now click the Load all diffs bookmarklet at the top of your browser to show all files during a GitHub PR code review. Done.

Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265