Help - how to compare branches? #168131
-
|
Topic Area: Question In order to compare two branches (as if creating a pull request without actually doing so), Google AI says;
However, after selecting a branch from the Branches dropdown (e.g. https://github.com/octocat/Spoon-Knife/tree/change-the-title) I see no "Compare" option "next to the branch name" nor a "Contribute" button: What is the step after selecting a branch ('change-the-title') to get the "files changed" comparison page, as in a PR, with another branch (e.g., 'test-branch')? EDIT:
This works, but manually editing URLs is a surprisingly primitive and unintuitive UX. Is there a Compare button somewhere that links to the comparison page, and if not, would it be too difficult to add to the web page, and to the documentation, which describes adding and deleting branches but says nothing about comparing?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Use GitHub’s Compare URL directly Replace: [Edited by @queenofcorgis to add the below] We have a good example here in the docs for comparing branches and commits as well: For more information, read Comparing branches in the GitHub Docs. |
Beta Was this translation helpful? Give feedback.
-
|
You're absolutely right — while the /compare URL trick works, it's not intuitive for users who prefer to use the GitHub UI without manually editing URLs. Currently, GitHub doesn’t provide a clearly visible “Compare” button directly on the branch dropdown or branch page, which can be confusing especially for new users. The expected UX flow (select branch → compare) feels incomplete without a visible or contextual “Compare with another branch” option. A couple of suggestions that might help others: Navigate manually to: Or use the "Pull requests" tab → Click "New pull request" → Then choose branches to compare — even if you don’t intend to create a PR, this gives you the diff view. That said, I agree — it’d be a great improvement to have a dedicated “Compare” button on the branch page or dropdown. Maybe worth submitting as a feature request or feedback to GitHub? The UX could definitely benefit from it. |
Beta Was this translation helpful? Give feedback.

Use GitHub’s Compare URL directly
You can manually construct the comparison URL:
https://github.com///compare/...
Replace:
with the branch you want to compare to (often main) with the branch you want to compare fromwith the GitHub username or org (e.g., octocat)
with the repository name (e.g., Spoon-Knife)
[Edited by @queenofcorgis to add the below]
We have a good example here in the docs for comparing branches and commits as well:
For more information, read Comparing branches in the GitHub Docs.