Skip to content

Instantly share code, notes, and snippets.

@obonyojimmy
Created January 4, 2017 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obonyojimmy/9176055237283780bba28d219c08a267 to your computer and use it in GitHub Desktop.
Save obonyojimmy/9176055237283780bba28d219c08a267 to your computer and use it in GitHub Desktop.
Git create remote repo

First, you create your branch locally:

git checkout -b

The remote branch is automatically created when you push it to the remote server. So when you feel ready for it, you can just do:

git push

Where is typically origin, the name which git gives to the remote you cloned from. Your colleagues would then just pull that branch, and it's automatically created locally.

Note however that formally, the format is:

git push :

But when you omit one, it assumes both branch names are the same. Having said this, as a word of caution, do not make the critical mistake of specifying only : (with the colon), or the remote branch will be deleted!

So that a subsequent git pull will know what to do, you might instead want to use:

git push -u

http://stackoverflow.com/questions/1519006/how-do-you-create-a-remote-git-branch

As described below, the -u option sets up an upstream branch:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment