简体   繁体   中英

In PhpStorm, is there a way to automatically associate a default server with a Git branch?

I have multiple remote servers, each associated with a different Git branch. When I switch to a different branch, I want PhpStorm to change the default upload server to something I can associate with the branch.

Is there a way to do this, maybe with Mappings?

I am concerned that I may switch branch and do a file upload and have the file uploaded to the "wrong" server (not the one associated with the branch, but the current default server).

No, but you can:

  1. Add a git setting for each branch (that will be used only by you)
  2. Write a little script that do the task to read this setting for the current branch and push to this remote (and not 'server' like you name it).
  3. Create a git alias that call the script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM