PHPStorm Synchronize - What exactly does it do?

Answered

What does the File->Synchronize option do in PHPStorm? 

I would assume one of three things:

  1. Synchronize my local so it matches remote.
  2. Synchronize my remote so it matches my local.
  3. Some combination of the two, though I doubt this one.

I don't want my changes automatically synced with my remote (not even on save action).  What I'm looking for is a way to switch to a particular Git branch and then make my remote match my current branch (including deleting files in remote which don't exist in my local).  I need to be able to leave my remote with say a "release" branch for others to test while I work on a "feature" branch on my local.  The problem with the "Upload to..." option is that it doesn't delete remote files which have been deleted in local.  Additionally, I was hoping the "Synchronize" option was smart and only uploaded/downloaded/deleted the files which have been changed rather than uploading everything or having to manually select each individual file manually.

Many thanks, I believe "Synchronize" is exactly what I'm looking for, but I couldn't find any confirmation and wanted to check before I go ahead and use it.

 

6 comments
Comment actions Permalink

Hi there,

>I would assume one of three things:

None of the above -- it just re-reads project files checking for possible external changes that were not detected automatically etc. It does not sync anything with any remote.

https://www.jetbrains.com/help/phpstorm/index-of-menu-items.html#d156084e24

0
Comment actions Permalink

Thank you Andriy.  

How would you suggest I achieve my desired setup?  What I currently have is a local web server which I work on directly.  Then I have two remote servers, one is staging where people test features and the other is production.  It's not uncommon for me to have to work on new features on my local independent of the staging server.  How can I make the staging server an exact duplicate of my local development at will (without automatic upload enabled).  If I just choose to upload the entire project, files are not removed from the staging or production servers if files were deleted on my local.

This seemed to make the most sense to me, but if I should be going about this differently I am open to any suggestions.

0
Comment actions Permalink

"Main menu | Tools" (.. or right click in Project View on desired folder/file .. or in the editor (for that single file only)) and then choose "Deployment | Sync with Deployed to XXX".

IDE will open dedicated window where after scanning the remote host it will list all differences so you can choose what to do on per-file basis.

https://confluence.jetbrains.com/display/PhpStorm/Sync+changes+and+automatic+upload+to+a+deployment+server+in+PhpStorm

 

On another hand: if all needed files are under VCS control... why not do a checkout there (via SSH session) -- should be faster I believe.

 

Side note: IDE checks each file (detailed info about modification timestamp) -- that already takes a while (especially if your project is rather big/lots of files). if you choose comparing files by content ... then it will be downloading each file .. which is even longer.

Overall Sync with remote is not very fast. If you need to do it often ... and can use something like rsync or alike -- better go that way.

0
Comment actions Permalink

Great, thank you Andriy.  

Much appreciation! 

0
Comment actions Permalink

Is it possible to sync a file on save to target folder?

I can do this on Netbeans, Eclipse PDT (with plugin).

Example: I create a CMS plugin in my project folder and I just want it to copy to target folder in CMS/plugins so that I can reload the web page and see changes.

0

Please sign in to leave a comment.