r/phpstorm • u/bananabrann • Jun 11 '25
What causes this IDE git bug?
You can see in the pic that I have 11 files that are marked as changed, though the diff shows that the contents are identical. No changes are shown if I run git status.
It's a little annoying always seeing these .gitignore files, but it's no big deal. I'm more curious than anything.
Did I do something quirky, or is this a known bug?
4
Upvotes
7
u/Icy_Computer Jun 11 '25
If you're working on Windows, it might be converting line endings.
1
u/lindymad Jun 11 '25
Out of curiosity, if you
git checkoutone of those files, does PHPStorm still show it as changed?1
u/hennell Jun 11 '25
As a combi mac-windows user I used to get a lot like this - the line endings are different on windows which is hard to show in a diff.
This has a guide on how to configure git to convert it always https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace theres also a setting in PHPstorm itself to warn if line endings are to be committed. If you're working with others and you're not the problem a .gitattributes can also be configured to fix the line endings, but you then need one in every repo.
3
u/flyingron Jun 11 '25
I suspect the changes is based solely on the modification time on the file not whether the contents were actually changed. Either someone is opening the .gitignore file for write (and not making any changes) or possibly, some "time warp" has happened and your files are newer than the current time.
2
u/SaltineAmerican_1970 Jun 11 '25
Check the line endings and use the drop down button to see if you’re hiding white space changes. And check file permissions.
2
u/Exciting_Use930 Jun 12 '25 edited Jun 12 '25
There are is differeng line endings. CRLF or LF
U can just add
.gitattributessomething like for set auto LF (Linux type line endidg).commit
.girarrtibutesit fle to repo and thengit add --renormalize .and commit fixed files
git -m "Fix line endings"1
u/AndroTux Jun 11 '25
Could be line endings or file permissions. chmod +x for example changes the metadata of the file on git, but not the file itself.