Search code examples
gitphpstormphpstorm-2017.1

PhpStorm - execute multiple commands with one button


I execute 3 commands very frequently - git checkout master & git pull upstream master & git push. Currently, when doing this through UI, it takes 2 clicks for checkout, 5 clicks for pull from upstream, 2 clicks for push. I have tried figuring out how to put this line under a UI button, but can't find a solution.

Some places suggest trying something with Tools > Settings > External Tools, but that does not allow executing multiple commands at once; it requires you to specify the full path to the executable (git in this case), and that breaks at the first join.

Another potential solution was Command Line Tools, but it has the exact same problem as External Tools, not to mention it can't be put under a button.

Is there a way to do what I want? I'm 100% sure that many other people would find this useful, since this is a very common thing to do in any forked GIT project.


Solution

  • Why not use Tools > Settings > External Tools and just write a script?

    #!/bin/bash
    git checkout master & git pull upstream master & git push
    

    (or a batch file if on windows)

    Then just execute the one script.