Deploying Committed Changes to a Remote Server

Posted on by Maarten Balliauw

Recently, we received the following question through Twitter: “What is the easiest way to deploy the changes of your last commit(s) to a remote project?”

Let’s explore our options!

This functionality is available in IntelliJ Idea, PyCharm, WebStorm, PhpStorm, and RubyMine.

Configuring a Remote Host

Working with a Remote Host is a broad topic of its own. To add a remote host, select Tools | Deployment | Configuration and provide the necessary details to connect to the remote host. This can be an FTP, FTPS or SFTP server as well as a local or remote folder. In this blog post we’ll use a remote server as a host which is accessed through FTP.

On the Mappings tab, we can also specify how the local and remote folder structure compare to each other. For example, we can map the local project root to a different content folder on the server.

Once finished, Tools | Deployment | Browse Remote Host will reveal the remote file browser. We can Drag & Drop files between the current project and the server and make use of synchronization.

Uploading files on commit

Let’s return to the initial question: how to deploy to this server when committing files to a VCS? Once a VCS system, whether Git, Mercurial, Subversion or another is registered for our project, we can make a change to our code and press Ctrl+K (Cmd+K on Mac OS X) to commit changes.

The Commit Changes dialog provides us with the option to upload files to a remote server after a successful commit. There is also a checkbox available which will automatically perform the upload after every commit.

Considerations

The automatic upload process for a commit only transfers the current changeset’s files to the remote host. All preceding commits will be ignored by this process.

For a single developer, this workflow is ideal. After doing an initial synchronization between the current project and the remote server, every commit will be sent to the remote host (as long as it’s committed through PhpStorm).

In a team, not every developer is always working on the latest version of the VCS repository. If every developer uploads only their last commit to the remote host, chances are some files deployed will not be the latest ones and several commits will never make it to the server.

It is important for teams to do the deployment using a standardized flow, preferably automated. This can be done using a Continuous Integration (CI) server, TeamCity for example, which fetches the latest commit, runs PHPUnit and deploys it to the target machine.

Let us hear your thoughts in the issue tracker, through the comments below or in our forums!

Develop with pleasure!
– JetBrains PhpStorm Team

Comments below can no longer be edited.

12 Responses to Deploying Committed Changes to a Remote Server

  1. William says:

    October 9, 2013

    i built a php page that goes a git pull.. all my projects get a /update to them.. so whenever i push changes to github it calls the url (using web hooks there)

    i used to use the above way of pushing changes but ftp is just sad now a days with all the brute forces going on

  2. Andrey says:

    October 10, 2013

    it would be nice to add ability to upload files to commit, from log history of changes. Right now i can’t upload interested file from log history 🙁

    • ad_on_is says:

      October 28, 2013

      +1

    • Jeroen says:

      May 7, 2014

      +1 Indeed! That would be very useful. Also the option to select multiple commits and with an added “Deploy” function to the context-menu.

    • Valeo says:

      August 4, 2014

      +1

    • John says:

      September 25, 2014

      +1

  3. ad_on_is says:

    October 28, 2013

    oh found it out…
    in changes-tab select all files that you want to deploy and hit tools->deployment->deploy to…

    • Igor says:

      January 16, 2014

      Thanks! Just what I needed.

    • Rahul says:

      February 19, 2014

      Thanks a lot! You saved me lots of time !! 😀

  4. PHPStorm – Git a FTP deployment na jednom místě | Ondřej Hudeček – blog says:

    August 1, 2014

    […] tedy cestu, jak eliminovat nutnost používat FTP na minimum. Shodou okolností jsem narazil na tento článek, který mi ukázal, jak na to. Je to vlastně jednoduché – při každém commitu se spustí […]

  5. FTP deployment with PHPStorm | Houdas Blog says:

    August 28, 2014

    […] the need to use FTP and PHPStorm helped immensely with that. Coincidentally, I came across this article, which helped a lot. It’s really simple – when you commit, you can start an automatic […]

  6. WordPress hosting, the easy way, with Flywheel | philsmart.me says:

    September 17, 2014

    […] Unfortunately, this one has created some chaos in my workflow. There is a considerable latency in connections to Flywheel’s SFTP servers, and it is not uncommon for a site upload to take a few hours. I know they are working on enhancing global support, but my solution, in the interim, has been to deploy committed changes using a local Git setup in PHPStorm. […]

Subscribe

Subscribe for updates