General developer forum

 
 
Picture of Joseph Rézeau
Github Compare view question
Group DevelopersGroup Particularly helpful MoodlersGroup TestersGroup Translators

Hi all Git and Github experts!

I was expecting the Github Compare view of 2 branches to simply show - by default - the differences between the current state of those said 2 branches, as the Git Diff with previous version: command does on a local git install, but not so... Here is my scenario.

1.- create test01 repository on github and clone to local machine

ON LOCAL MACHINE

2.- master: add test.txt
3.- test.txt: aaa ccc
4.- commit (message: step01) and push to master
5.- create branch01 branch Base On HEAD(master) and switch to it
6.- branch01 modify contents of test.txt to aaa bbb ccc
7.- commit (message: step02) and push to branch01
8.- switch to master and modify contents of test.txt to aaa bbb ccc
9.- commit (message: step03) and push to master
10.- switch to branch01
11.- Git Diff with previous version: master -> the diff window is empty, since all files in both branches are identical. This is what I expect to see.

GO TO GITHUB

12.- Now go to my github https://github.com/rezeau/test01 and select branch:master and click the test.txt file to view it. It shows: aaa bbb ccc
13.- Now Select branch: branch01 and click the test.txt file to view it. It also shows: aaa bbb ccc.
14.- Now I want to compare the master and the branch01 branches, same as I did on my local machine, using the Git Diff command. So, whilst still on the branch01 branch, click the Branches tab (2).
15. Now click the Compare button at bottom right. I am expecting the Compare View to show nothing, since all files in both branches are identical. But it shows in file test.txt a previous state (- aaa ccc) and the current state (+aaa bbb ccc).

Note: the "comments" zone shows step03.
16.- If I click the Switch base of comparison, I see the same. Except that the "comments" zone now shows step02.

---OK, continuing experiment ON LOCAL MACHINE---

17.- Check that we are on branch01. Edit test.txt file to read: aaa bbb ccc ddd
18.- Commmit to github as step04 and push to github, branch01
19.- Git Diff with previous version: master -> the diff window shows, as expected
on the left (master) aaa bbb ccc
on the right (branch01)  aaa bbb ccc ddd

19.- GO TO GITHUB

20.- Try to compare again the master and branch01 branches. In the "Showing 1 changed file with 1 addition and 1 deletion." zone I see:
-aaa ccc
+aaa bbb ccc ddd
Where I would expect to see:
-aaa bbb ccc
+aaa bbb ccc ddd

Question: When comparing 2 branches, how can I get displayed on my github (screenshot #1) the very same results as I get on my local machine (screenshot #2)?

Joseph

screenshot #1

Screenshot #1

screenshot #2

screenshot #2

 
Average of ratings: -
Dan at desk in Moodle HQ, Perth
Re: Github Compare view question
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers

I'm not very skilled with github's interface, but I really love that their URL scheme works like the git commandline does itself. So to do it in compare view you could do:

https://github.com/rezeau/test01/compare/706b554...branch01

However, I find the interface to get to that incomprehensible, so I can't help.

But maybe you just want to look on an individual commit by clicking on it:

https://github.com/rezeau/test01/commit/93b8c62b048aa1496bd2322646cc563e88832fa5

(Sorry that isn't a great answer to your question).

 
Average of ratings: -
Me!
Re: Github Compare view question
Group DevelopersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers

Well - im not going to answer very well either but when constructing my git diff urls for the tracker, I build a URL like: 

https://github.com/damyon/moodle/compare/4737ac1343708ba084c1e214bec5000d4b67bbec...MDL-35740-master

Where the hash is the commit on master before my changes. This way I can push to master whenever I like (or not at all) and all my existing git urls wont change. Also - when (if) my patch gets accepted my git diff urls still continue to work so anyone looking at the bug can still see what changed (This also means I leave all my old branches in github).

- Damyon

 
Average of ratings: -
Picture of Joseph Rézeau
Re: Github Compare view question
Group DevelopersGroup Particularly helpful MoodlersGroup TestersGroup Translators

Hi Damyon and Dan and thank you for offering to help. Eventually I contacted support@github.com and here is their answer:

Hi Joseph,

This is not possible currently, but we might add it in the future.  Thanks for the suggestion, I'll add it to the Feature Request List™ so the team can see it.

Petros

That's what I thought.sad

Joseph

 
Average of ratings: -