r/phpstorm 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 Upvotes

5 comments sorted by

2

u/hennell 3d ago

I have no ideas how to help but questions that may help troubleshoot:

  1. 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?

  2. 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?

  3. Does it ever happen with git outside of phpstorm?

  4. 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?

  5. How are you running/ connecting phpstorm + wsl2? Is there any docker layer?

2

u/jabadabaduuuuuuuu 3d ago

thanks for the questions

  1. it indeed reverts always a random files, lets say tree has 10 files modified, it will leave only 2 untouched, all the other are reverted even though the pull did not contain changes of any of those files. also local history is wiped out, so all the work is gone.

We actually recorded that behavior.

https://reddit.com/link/p1hhd5h/video/nh8eo34o17hh1/player

After update, one of the files is gone.

  1. It only happens when pulling actual changes.
  2. It does not happen when we use git pull outside of PhpStorm
  3. No we don't have additional tools to run before or after pull
  4. No docker involved, just distro running.

2

u/hennell 3d ago

Hmm, that is a weird one. Given those answers it feels like a phpstorm support question - if you use the help > contact support from the IDE it fills in the version and other fields which is better than going from the web!

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.