What's the method to compare different branches directly on GitHub's interface?

I’m trying to figure out how to view differences between two branches using GitHub’s web interface. I know this functionality exists since pull requests show all the changes in a nice visual format. But is there a way to see these comparisons without creating an actual pull request?

Basically, I want to check what my changes look like compared to another branch before I submit a pull request. I could use git diff in the terminal, but GitHub’s web interface makes it much easier to read and understand the differences visually. Does anyone know if this is possible directly through GitHub’s website?

yep theres actually a shortcut i use all the time - just add /compare/branch1...branch2 to your repo url and it takes you straight there. way faster than clicking through the interface imo. works great for quick checks before making prs

GitHub has a built-in compare feature that you can easily utilize. Go to your repository’s main page, and next to the branch dropdown, there’s a “Compare” button. Alternatively, you can construct the URL manually: github.com/username/repository/compare/base-branch...compare-branch. This will give you a diff view similar to what you see in pull requests, showing file changes side-by-side. I often use this method when I need to compare branches before submitting a pull request. It’s a great way to visually assess differences without creating an actual pull request.

Another approach is navigating directly through the repository tabs. When you’re viewing any branch, you can access the compare functionality by modifying the URL structure or using the repository insights. I’ve found that appending /compare to your repository URL and then selecting the branches from the dropdown menus works reliably. The interface will show you commits, file changes, and contributors between the selected branches. This method is particularly useful when you need to compare non-adjacent branches or when working with forks. The visual diff is identical to pull request previews, making it perfect for code review preparation before formal submission.

I discovered this feature through the repository insights section. When you click on the Insights tab, there’s a Network graph that shows branch relationships, and from there you can access comparison tools. However, the most straightforward method I use regularly is through the Pull Requests tab - click “New pull request” but don’t actually create it. Just select your branches in the dropdown menus and GitHub will display the full comparison immediately. You can review all the changes, commits, and file diffs without submitting anything. This approach gives you the exact same interface as a real pull request preview, which is perfect for thorough code review before making any commitments.