I wrote some code in a branch branch1, in path /abc/def/myscript.php. It was a work in progress, so it has never been merged into the master branch. One of our other developers copied this script to a new branch branch2, and put it in path /xxx/yyy/myscript.php. Both branches are in the same Github repository.
The paths are different because when I was writing the code I didn’t know where it would eventually be deployed. The repository is organized by target servers, I just made up a generic server name as a placeholder until we decided this. Now it’s being deployed along with some supporting code that the other dev wrote, so he moved it into the real server’s directory.
Now he’s submitted a pull request for branch2, and I’m reviewing it. I’d like to see what changes he’s made to the script since copying it from my branch.
How can I compare these files with different paths in different branches?
Extra points if this can be done from a JetBrains IDE (I’m using PhpStorm), although doing it from github.com or using git CLI commands is acceptable.
>Solution :
In PyCharm, you have the git tab at the bottom left. There right click on the branch (branch2) you want to compare with your branch (branch1) and select merge into branch1. The following comparing tool can be used to see differences very well without actually merging, since you only want to see the changes made. There, you should be able to select the file, although it is in a different path.