Bitbucket Cloud: "The diff for this file is empty"
The pull request lists the file as changed, and the file tree may even count added and removed lines, but the diff says "The diff for this file is empty". Atlassian's knowledge base gives three causes: the change is only whitespace, only the file's permissions changed, or the browser (Pull request diff is not shown or shown as empty).
Only whitespace changed
Each pull request can hide whitespace changes. If a file's change is only whitespace and that option is off, the diff for the file shows as empty. Open the pull request's settings and check Whitespace changes; the diff appears.
To see the change without the browser: Pull Request Inbox for Bitbucket, a plugin for JetBrains IDEs, reads each changed file whole from Bitbucket and compares the two versions in the IDE's diff viewer.
Only the file mode changed
Git records a file's permissions as well as its contents. A commit that only made a file executable (or took that away) lists the file with nothing to show. To see what changed, run this on the commit:
git show <commit>
A mode change looks like this:
old mode 100644
new mode 100755
If the change was not meant, set the mode back and commit (-x takes the executable bit away, +x gives it):
git update-index --chmod=-x path/to/file
git commit -m "Restore file mode"
On a file system that doesn't keep the executable bit, git config core.fileMode false stops Git from picking up mode changes from the working tree.
The browser
If neither of those fits, Atlassian points to the browser: open the pull request in a private window, or turn off browser extensions and turn them back on one at a time to find the one that blanks the diff. In the community thread Pull Requests showing empty diffs, some people fixed it with a hard reload (Ctrl+Shift+R, or Cmd+Shift+R on a Mac), another browser, or by turning off one extension.
Check the change locally
A pull request shows the changes on the source branch since it split from the destination, the same as a three-dot diff:
git fetch origin
git diff origin/main...origin/feature -- path/to/file
If this prints the change and the page still says the diff is empty, the page is at fault, not the commits. In the community question The diff for this file is empty, one user saw it only on files whose name or folder had a space in it, and another could still see the change with "View raw commit".
A different message, "File renamed but contents unchanged", on a large file that was both renamed and edited, was a bug Atlassian marked fixed (BCLOUD-21973).
Bitbucket pull requests in IntelliJ IDEA
Pull Request Inbox for Bitbucket, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the pull requests that wait for your review in an IDE tool window. It reads each changed file whole from Bitbucket and compares the two versions in the IDE's diff viewer, so a browser problem can't blank it, and whitespace follows the diff viewer's own setting. The review inbox, diffs, discussions and merge checks are free; approving, commenting and merging are Pro, with a 30-day trial. It also works with Bitbucket Data Center (beta).
Get it on JetBrains Marketplace
Bitbucket and Atlassian are trademarks of Atlassian; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Atlassian or JetBrains.
More: The diff for this file is too large to render · Changes that are already merged · 日本語