0

Is it possible to show diff between 2 branches using GitHub web interface? Is it possible to show diff between 2 commits using GitHub web interface?

jthill
  • 55,082
  • 5
  • 77
  • 137
mrgloom
  • 20,061
  • 36
  • 171
  • 301

2 Answers2

5

To show the difference between two branches, do the first step of starting a pull request. You can either use the UI interface on GitHub.com, or adapt this URL:

https://github.com/<account_name>/<repo_name>/compare/<base-branch>...<compare-branch>

To see differences between two commits you can adapt this URL (I do not know how to "click" myself to this):

https://github.com/<account_name>/<repo_name>/compare/<commit-base-short-sha>..<commit-compare-short-sha>

See here for a description of the difference between the .. and ... in the two URLs above.

TheIceBear
  • 2,912
  • 9
  • 23
2

Select your branch and click on "Compare":

Compare branches

You will be able to select the branch to compare with.

Philippe
  • 28,207
  • 6
  • 54
  • 78
  • What about diff between 2 commits? (I mean not between 2 commits, but more like between states at these 2 commits) As I understand I can just create branches from these 2 commits and use your method to compare branches, but is there more direct way? – mrgloom Sep 17 '20 at 14:46
  • See my answer for a more direct way to see commit diffs – TheIceBear Sep 17 '20 at 15:53
  • I have checked this method to compare 2 branches and it gives me weird results, like highlighting diff of removed lines that are not presented in 1st and 2nd branches final state. – mrgloom Sep 17 '20 at 15:59
  • Actually (2 dots) `https://github.com///compare/..` is what I was looking for, and (3 dots) `https://github.com///compare/...` seems the same as if we use `Compare` from web interface and it produce 'weird' diff. – mrgloom Sep 17 '20 at 16:05
  • Yes, when comparing branches GitHub defaults to 3-dots. What is weird about it? – TheIceBear Sep 17 '20 at 16:32