Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm – how to upload only modified files?

Tags:

phpstorm

I have a project in PhpStorm. I press upload to ftp on root folder and all files are uploaded to server. Then I work on this project – lets say modifying one file. When I press upload to ftp now, I see all files are being uploaded again – but they are not modified after last upload.

I do not want to upload automatically nor on explicit save action. The setting overwrite up-to-date files in settings → deployment → options is NOT checked.

Sync with deployed is not a solution, because a project is huge ant comparing every file by content is a total waste of resources and time.

How to upload only modified files?

like image 563
Maug Lee Avatar asked Jun 19 '13 10:06

Maug Lee


People also ask

How do I upload changed files in PhpStorm?

In the Settings/Preferences dialog Ctrl+Alt+S, go to Build, Execution, Deployment | Deployment | Options. From the Upload changed files automatically to the default server list, choose when you want PhpStorm to upload changed files:

How do I view the deployment logs in PhpStorm?

PhpStorm shows the logs in the File Transfer tool window ( View | Tool Windows | File Transfer ). In the Project tool window, right-click a file or folder, then select Deployment | Upload to from the context menu, and choose the target deployment server or server group from the list.

How do I deploy changes in PhpStorm after they are committed?

In the After Commit area, you can select the server access configuration or a server group to use for uploading the committed files to a local or remote host, a mounted disk, or a directory. See Deploy your application for details. Run tool: select the external tool that you want PhpStorm to launch after the selected changes have been committed.

How do I push changes from PhpStorm to Git?

PhpStorm allows you to upload changes from any branch to its tracked branch or to any other remote branch. To push changes from the current branch press Ctrl+Shift+K or choose Git | Push from the main menu. To push changes from any local branch that has a remote, select this branch in the Branches popup and choose Push from the list of actions.


4 Answers

Go to File > Settings, on Project Settings choose Deployment. Add a FTP server and mark it as default. Click OK to close the dialog window.

Now go to Tools > Deployment > Options. Choose the action trigger where you see: Upload changed files automatically to the default server

I hope it helps!

http://www.jetbrains.com/phpstorm/webhelp/uploading-and-downloading-files.html#automaticUploadOnUpdate

like image 146
fromvega Avatar answered Oct 12 '22 11:10

fromvega


Best Practice Conventions: PHPStorm is designed around what is commonly considered "Best Practice". With that in mind many aspects of the deployment are best taken advantage of by having a version control system in place. When you commit via PHPStorm the commit dialog provides options to explicitly deploy the files in the changelist to a specific server (defaults are configurable)

Alternative 1: There is an option to "Sync with Deployed to yourhost" which can be used to compare your remote server files with your local files. "Project Pane"->(right click folder or file)->Deployment->"Sync with Deployed to ..."

This option launches a diff application which compares your selected file/folders and hints at what action should be taken (i.e. sync direction to/from deployment server)

I've only use this feature on target file sets as it has performance issues with large sets of files (e.g. the entire project in my case).

Alternative 2: For small file sets. Turn on automatic deployment temporarily with the "Explicit Save" option and then resave your files.

like image 24
Lance Caraccioli Avatar answered Sep 22 '22 00:09

Lance Caraccioli


commit your project using PHPStorm (Ctrl+K)

it will open a window with lots of options to ease you the committing

also, there is "After Commit" tab, there you can choose from default servers you previously configured (Tool > Deployment) to upload files to

this way with the help of VCS only changed files will be uploaded to your server

like image 2
Amir Keramat Avatar answered Oct 12 '22 09:10

Amir Keramat


First of all, I don't recommend using FTP for projects where security required. (By FTP connections password and data travels in a non-encrypted format, so it can be stolen easily. The only exception when the uploaded files (probably packages) are signed and the digital signature is checked on the server before doing anything with them. Afaik. PHAR is the default lib for that, but it is relative easy to encrypt and sign any zip file, if you put the signature into the file name. Don't confuse digital signature with md5 or sha1 hash.)

By simple projects with FTP I use git-ftp.

Installation (by windows, but I think it works every system as well)

git bash
$ cd ~
$ git clone https://github.com/git-ftp/git-ftp git-ftp.git
$ cd git-ftp.git && chmod +x git-ftp
$ cp ~/git-ftp.git/git-ftp /bin/git-ftp

Configuration

.git/config
      [git-ftp "myscope"]
        url = ftp.domain.com/subdir
        user = user
        password = pass

Initialization

git-ftp catchup -s myscope //by this the FTP and the local copy must be in perfect sync

Upload

git ftp push -s myscope

You have to use a .git-ftp-ignore file to define what you don't want to upload.

I usually use git-ftp with git merge and commit hooks.

.git/hooks/post-commit
.git/hooks/post-merge

    #!/bin/sh
    branch=`git rev-parse --abbrev-ref HEAD`
    if [ $branch == "master" ]; then
        git ftp push -s myscope
    fi

With those git-ftp automagically uploads by any changes of the master branch. Ofc I use master branch for releases only, for development I use another branches...

like image 1
inf3rno Avatar answered Oct 12 '22 09:10

inf3rno