miguel.nz

Create alias for git remote add origin

May 5, 2015   |   1 minute read.

I always forget the url from my git projects. So I decided to create my own alias and I want to share it with all of you guys. As you may know alias command line in OSX doesn’t accept arguments unless you’re having a function so to achieve this you’ll need to do something like that in your ~/.bash_profile.

add_origin() {
    git remote add origin ssh://[email protected]:9090/path/to/git/folder/$2.git
}
alias addorigin=add_origin

Basically $1 is your username and $2 is your lovely GIT folder.

Xoxo.