-vutjg
Last Updated: February 20, 2016
·
1.822K
· Abizern

Be more descriptive with your remote names.

Be default, when you clone a repository, the remote repository is named origin Not exactly descriptive is it?

You can be more descriptive about these remote names - and this is handy when you have more than one remote for your repositories. Here are a couple of examples:

Private Project.

So you have a project on your local machine and you have a remote repository on Github and another on Dropbox - origin isn't a specific enough name for these remotes - call them github and dropbox so you at least know where a remote is from its name.

Public Project.

You have forked a project on Github where there are many contributors that you have repositories that you have set up as remotes so you can pull their changes. name the remotes after the person's github name, and name your fork as github it makes it a lot easier to know who's repository that remote refers to.

--

There are a couple of ways to do this.

1. Rename a remote:

git remote rename old_name new_name

2. Add a remote with a name.

git remote add remote_name remote_url

3. Clone a remote repository with a distinctive name.

git clone -o remote_name repository_url