GitHub pushes don't show diff's correctly

Hey everyone,

I'm new to PhpStorm and I'm really liking it so far. The Git integration is great!

However, while I can push fine to our GitHub repositories, I'm having an issue with the diffs showing up within GitHub. Basically, if I edit 2 lines out of 100 total in a file, in GitHub, is shows 100 lines deleted and 100 added. This makes it impossible to determine what was changed from my pushes when viewing from within Github. If I edit a file outside of PhpStorm and push to the repository using the WIndows GitHub client, or the official Git tool, it shows the 100 lines but shows a minus for the 2 lines I deleted and a plus for the 2 lines I added.

Is there a setting I'm missing that can fix this? I'd like to have my pushes from PhpStorm show the diffs correctly from within Github.

6 comments
Comment actions Permalink

Hello Kris,

Thanks for your feedback.

It seems that the files you change get committed with other line separators, than they are in the repository. That's why it looks like all lines were changed (they were in fact: each line has change its separator).
Since you don't experience this issue when committing from the command line, I suppose that you might be using different Git executables in PhpStorm and in CLI (or GitHub client). Please go to Settings | Version Control | Git | Path to Git executable and check that it is the same Git, that you use from the command line.

Also please check Settings | Version Control | Git | "Line Separators Conversion": what is the value there?

0
Comment actions Permalink

Thank you for the reply.

Settings | Version Control | Git | Path to Git executable: C:\Program Files (x86)\Git\bin\git.exe

That appears to be correct. When I test it it comes back with a success. Although, when I've done pushes on my PC with Git I've used their GUI and BASH applications:

GUI: C:\Program Files (x86)\Git\bin\wish.exe" "C:\Program Files (x86)\Git\libexec\git-core\git-gui"
Bash: C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"

Maybe I should be linking to a different executable within phpStorm?

Settings | Version Control | Git | "Line Separators Conversion": Convert to project line separators

That's what I have for that setting.

It's also worth noting that I have to run the two attached jar's from this thread in order to connect to Github in the first place:

http://youtrack.jetbrains.com/issue/IDEA-85769

0
Comment actions Permalink

Which setting do you have under Settings | Code Style | General | Line separator (for new files) ?
Please also execute git config core.autocrlf from the project directory.

The jars fixing the bug with Github are not related to the problem, but thanks for mentioning this detail.

0
Comment actions Permalink
Please also execute git config core.autocrlf from the project directory.

When I execute that command using Git Bash, the response is: true

Which setting do you have under Settings | Code Style | General | Line separator (for new files) ?

System Dependent

0
Comment actions Permalink

Please try changing the setting Settings | Version Control | Git | "Line Separators Conversion" to "Do not convert".

0
Comment actions Permalink

I did a push to GitHub today and it looks like it's working correctly now with that change. Thank you!

0

Please sign in to leave a comment.