3

I'm working with drush & git and I would like to create a custom drush alias to perform a "git pull" action on a remote server.

This is possibile creating a drushrc.php file in drush home directory with this command:

$options['shell-aliases']['git-checkout'] = '!git checkout';

So if I run

drush @mysite.test git-checkout

the system performs a "git checkout" on the test server.

The problem is that I would like to send parameters, like:

$options['shell-aliases']['git-checkout'] = '!git checkout %branch';

and so:

drush @mysite.test git-checkout my_custom_branch

should checkout a specific branch.

Is there a way to do this?

4

Drush will pass any extra argument in the shell alias to the command. So define the shell alias as:

$options['shell-aliases']['git-checkout'] = '!git checkout';

and simply run

drush @mysite.test git-checkout my_custom_branch
  • Ok you are right :) – arrubiu Aug 7 '13 at 10:15
0

You can use special shell alias replacements such as {{sitealias-item}}, {{%pathalias-item}} or special {{@target}}, which is replaced with the name of the site alias used.

Or maybe instead of trying to create complex alias, try creating a command file called COMMANDFILE.drush.inc (as already suggested by arrubiu).

0

Maybe the solution is to create not an alias, but a custom command for drush (here are the instructions).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.