Mapping a local branch to a remote branch in GIT

If you’ve created a git repository using the following steps:

  1. Created a local git repository using “git init .”
  2. Created a remote repository on github.com or another host
  3. Added that remote to the local repository using “git add remote origin <path to remote repo>”

Then you might be in a state where your local master is not mapped to the remote master. To fix that run the following command:

git branch --set-upstream master origin/master

I suspect that in step 3 there could be a way to specify the mapping so it doesn’t have to be done later explicitly, but I’m not aware of it currently.

Advertisements
Mapping a local branch to a remote branch in GIT

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s