0

I have two branches that haven't been merged for a long time and I'm trying to see the differences. I get a phantom deletion.

If I start a pull request the github website shows me non-changes as changes (e.g. something that is equal in both branches shows as changed to the version I'm trying to merge in). Basically if I made a change to both branches it shows it as a change associated with this pull request.

There are good tools for doing this at the command line, e.g. Showing which files have changed between two revisions.

But is there a way to just see the changes between two branches on the github website?

Here is a small example

https://github.com/pdbailey0/knitIgnore/pull/1/files

It's showing as (phantom) deletion that something that clearly isn't when you look at the source

from c1 https://github.com/pdbailey0/knitIgnore/blob/c1/DESCRIPTION

and c2 https://github.com/pdbailey0/knitIgnore/blob/c2/DESCRIPTION

Community
  • 1
  • 1
pdb
  • 1,574
  • 12
  • 26
  • Are you sure the example you provided is not a simple matter of CR / LF? – Joe DF May 10 '17 at 14:39
  • I made both edits on the github webiste, so I'd be surprised if that was it. – pdb May 10 '17 at 14:41
  • Also, what's on the left on lines 7 and 8 is just wrong. Neither version has the Depends line being on two lines. – pdb May 10 '17 at 15:01

2 Answers2

1

The person who responded from support@github made a comment that lead me to a solution:

I have two branches: beta (B) and release (R) and I'm trying to merge any bug fixes I have in R into B. To do see the diff (but not delete anything I deleted from B when creating R do this:

  1. Make a copy of B (Bcopy).
  2. Merge R into Bcopy. When this is done there could be merge conflicts. Always resolve these with a preference for R. (this can be done automatically with grep -lr '<<<<<<<' . | xargs git checkout --theirs where theirs is literal and does not need substitution. See here
  3. Now create a pull request of Bcopy into B. This gives the diff I desired.

It's pretty kludgy, but it works.

Edited to give code to automerge.

EDIT: here is what I do. Here you sill have to substitute in your beta for B

git checkout B 

make sure that it is clean, then

git checkout -b Bcopy

on the next line you will have to substitute your release in for R

git merge R 
grep -lr '<<<<<<<' . | xargs git checkout --theirs
git add --all
git commit -m "merge"
git push origin Bcopy

Now you can go to the website and diff B and Bcopy and see an honest diff!

pdb
  • 1,574
  • 12
  • 26
0

Does something like this help?

https://help.github.com/articles/comparing-commits-across-time/#comparing-branches

Update:

From github, go to branches, and select a branch, c1 for example over here. From there click compare, which is right below the green Clone button. Which should bring you to the compare page. From there select the branches you want to compare.

https://github.com/pdbailey0/knitIgnore/compare/c2...c1

Update: After talking to a staff at support@github.com, found out that the file by file comparison we are trying to achieve here over branches is currently not supported by github. Sorry.

Samip Suwal
  • 1,253
  • 11
  • 17
  • That's the view that I wish would show me the changes. Instead it appears to show me stuff that was in a commit, even if it's the same between the branches. – pdb May 10 '17 at 14:37
  • also quick note about the deletion. your main branch has multi line in the Description file, however it has been changed to one line in one of your branch commits, so github is telling you that that line in red will be changed/deleted and replaced by new line green, when you merge. I hope that makes sense. – Samip Suwal May 10 '17 at 15:01
  • I'm confused. Neither branch has a two line "Depends" line. I'm looking for a view that doesn't show that non-change as a change. – pdb May 10 '17 at 15:04
  • Hi Paul, I did few quick tests, which leads me to believe that it is displaying the changes made in the commit. Its not looking at each and every file for difference between two branches, but the commits made in the branch listed in the compare section. And one of your comment was to make the two line into one line. – Samip Suwal May 10 '17 at 16:43
  • Right, so my question is, how can I find what I'm looking for -- a view that shows the diff between two branches. – pdb May 10 '17 at 17:16
  • so I couldn't really find any thing that helps us to do what we want here, I have sent an email to support@github.com regarding this. I will keep you posted in this. – Samip Suwal May 10 '17 at 18:12