2

Let's say I have 2 branches - A and B.

B is ahead a few commits and behind a few commits.

I want to merge B into A (let's say no conflicts).

I open a PR: Merge B into A.

It shows, for example, 3 files that are Diff.

Now, lets say I edited and pushed manually to brach A changes to 2 out of the 3 files to be the exactly same as branch B. I expect when I open the same PR again to show me there is only 1 file that has diff, but no, since github looks diffs in commits, it shows me there are still 3 files that are "changed".

Any external tool to show diff between files? not commits?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
SimonSK
  • 153
  • 4
  • 12
  • 2
    I don't think that's a good thing to do. If you want to use some code in the branch A from branch B, you should use cherry-picking to do it, instead of writing the similar code to two different branches. But let's just say you need to do this. If you know the specific files, you can use `git diff` [between two branches](https://stackoverflow.com/a/8131164/16638833). If you know the directory, but not the specific files, you can [compare the changes dynamically](https://stackoverflow.com/a/49652793/16638833). Does this answer you question? – TDiblik Jan 24 '22 at 17:30
  • 2
    I'm pretty sure the sources I linked say otherwise (didn't try it tho), have you tried it? – TDiblik Jan 24 '22 at 17:36
  • 2
    `git diff A B` shows the difference between both head commits of branches A and B. If a file is the same in A and B, it won't show up in the output of `git diff`. GitHub might show the changes of a branch (i.e. diff with the merge base), not the difference to the target – knittl Jan 24 '22 at 17:49

0 Answers0