↓Skip to main content

Reviewing Code Locally

·1 min

So GitHub is having another incident (https://www.githubstatus.com/), affecting the UI and GitHub Actions:

GitHub status page listing incident updates: Actions, Pull Requests, Issues and API Requests experiencing degraded availability

I usually use GitHub (https://github.com/<org>/<project>/pull/<pr>/changes) to review changes, together with checking out the branch to look at details in my code editor, but this time it was not possible to review using the GitHub UI due to the incident:

GitHub error page saying “We couldn’t respond to your request in time.”

How to review a PR locally:

  • using git: git diff origin/master...HEAD
  • using gh: gh pr diff <pr-number>

This looks simple, but it’s missing line numbers. You can use vim/neovim to get your existing syntax highlighting and line numbers:

# vim
git difftool -y -t vimdiff origin/master...HEAD
# neovim
git difftool -y -t nvimdiff origin/master...HEAD

This approach works fine, but it goes file by file — on a branch with a lot of modified files, that gets annoying for me. This is where delta comes in:

git diff origin/master...HEAD | delta --line-numbers