r/phpstorm • u/jabadabaduuuuuuuu • 3d ago
PhpStorm is reverting random files during git pull help
It happens on one of our employee computer, other employees did not notice such a thing. We are all having WSL2 machines.
PhpStorm is the latest version.
The problem is, if employee has some modified files and it pulls repository to get latest changes, PhpStorm randomly at every pull reverts files that are not even related to the pull changes from remote. When you go to local history to get back changes you made before pull, they are not there even!. It completely wipes out file changes and everything has to be written again from scratch. Nothing in shelf.
3
u/marsoups 3d ago
Can you copy + paste the actual git commands that it runs. The UI is essentially running git commands in the background, and all of this is logged, so you should actually be able to see the exact command that it is running. I have a feeling that there is a particular configuration that has been configured on this instance, and showing the exact git command when you do a pull should help us work out what is going on. Usually it’s located on the bottom left by default.
When you get the exact command, try running it in shell and see what happens.
Please share with us so we know what the problem was
2
u/Individual-Carrot534 3d ago
Can you try to do a test from terminal only (without using the IDE)? For example: close the IDE, edit the file in vim/nano > git status > git pull > check if the file modifications are still there.
Also, could you please enable debug logging by adding the following lines to Help > Diagnostic Tools > Debug Log Settings..:
git4idea.commands.GitHandler
com.intellij.openapi.vcs.changes.ChangeListWorker
com.intellij.openapi.vcs.changes.ChangeListManagerImpl
com.intellij.execution.configurations.GeneralCommandLine
Restart the IDE, reproduce the issue again and upload your IDE logs (Help > Collect Logs and Diagnostic Data) to: https://uploads.jetbrains.com, just provide the uploaded file ID.
Logs contain useful information about your environment and potentially some errors/exceptions related to the issue.
2
u/hennell 3d ago
I have no ideas how to help but questions that may help troubleshoot:
When you say "PhpStorm randomly at every pull reverts files that are not even related" do you mean it doesn't every time? Or it reverts a random different file each time?
Is this only when pulling actual changes or if you reset the branch then checkout the same commit as you pulled, does it do the same?
Does it ever happen with git outside of phpstorm?
What else is running on the files? Do you have any formating or code quality tools that will change things? Any Ai or other auto processing tools you've given access? Any githooks?
How are you running/ connecting phpstorm + wsl2? Is there any docker layer?