I'm using the zsh shell on ArchLinux and I want to know if there's an easy way to make "advanced" aliases.

Normal aliases work just fine. However I can't find a way to create an alias for a substitution like:

git clone git@home:some-repo.git


git clone git@

Is there any simple way at all to do this directly in zsh with alias (or something similar)? Of course it should be generic so I don't need and alias for every git action on every repository.

Thanks in advande!


In this particular case, you can do it through git rather than through zsh. Add the following to your ~/.gitconfig:

[url "git@"]
    insteadOf = "home:"

Now git clone home:some-repo.git (and other git commands) will use the correct repo.

In the more general case, if you want to do a command substitution that's more advanced than what an alias allows, look at shell functions.


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.