I'd like to set up an alias push, which would translate into git push origin ARG1:ARG1.

For instance, from the command line, i'd like to push A B and get that translated to git push origin A:B

How should my alias export statement look for this to work?

  • For what shell and/or operating system? – Der Hochstapler Feb 29 '12 at 19:40

You can use aliases to automatically pass default arguments to the original command.

So, in your case, you can alias git push origin with push if you need. But you can not achieve what you are trying to do. You should use bash functions instead.

  • 1
    Something like this function push { git push origin $1:$1; }? – JAM Feb 29 '12 at 19:48
  • do you want to use $2 (for B?) – Mallik Feb 29 '12 at 19:52

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.