Search code examples
version-controlformattingphpstormgit-commit

What does Reformat code do when pushing to Git in PhpStorm and where to set it?


I've found that there is a option to Reformat code before commiting it to Git repository. My idea when I saw this was that I can use two different formatting for myself and fxp. team/company. Is this what is this option suppose to do? If so where can I specify the code formatting for commiting? And what is the difference between Reformating and Rearranging code?

PhpStorm git push options

I've tried my luck in PhpStorm documentation but I've found only where to set code formatting for the local Reformat option.

Thanks in advance


Solution

  • My idea when I saw this was that I can use two different formatting for myself and fxp. team/company. Is this what is this option suppose to do?

    No. Reformat code in Before commit is the same as Code/Reformat code... - i.e. it formats the files being committed according to your project Code Style preferences (Settings (Preferences) | Editor | Code Style).

    Rearrange Code command sorts/groups statements in your files (same as Code/Rearrange Code) according to arrangement preferences, if any (https://www.jetbrains.com/help/phpstorm/2016.1/code-style-php.html?from=old_help#d468513e1246).