Is there a way to use GitHub's "compare view" to view the diff between the current versions of two branches? (That is, to view the same diff that you would get if you did git diff <a-branch> <another-branch>
.)
I have made a small example here. There are two branches: "master" and "other-branch". If I do git diff master..other-branch
, this is the diff:
diff --git a/README.md b/README.md
index 495cc9f..3d2c3a0 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,3 @@
Hello there!
+
+This is a commit to the "other-branch" branch.
You can see from that diff that the difference between the "master" branch and the "other-branch" branch is the addition of one blank line and one line of text, and there are no deletions.
However, if I try to use GitHub compare view (https://github.com/akenney/compare-view-test/compare/other-branch or https://github.com/akenney/compare-view-test/compare/master...other-branch), it shows this diff:
-This is a commit to the master branch.
+Hello there!
+
+This is a commit to the "other-branch" branch.
It is comparing the "other-branch" branch with an old version of the "master" branch, not with the current version. The same thing happens even if I specify the particular commits to compare (https://github.com/akenney/compare-view-test/compare/8ed0d53...e4470ec) - the diff that it's showing is not the diff between those two commits.