Maiasaura
Maiasaura

Reputation: 32996

How do I create a remote branch?

If I create branches on my local git repos like so:

git checkout -b test

then do a push

git push

I don't actually see the new branch test in my GitHub page. How do I make my remote branches mirror my local branches?

Update

When I made a commit (even though there were no changes) and ran:

git push origin test

that worked. But is that the correct way? Shouldn't a git push push all local changes to the remote repository?

Upvotes: 0

Views: 81

Answers (2)

knittl
knittl

Reputation: 265855

You have to push new local branches explicitly:

git push origin test:test

Otherwise Git would push any (temporary) local branch you created3

Upvotes: 0

vcsjones
vcsjones

Reputation: 141688

Use

git push -u origin test:test

To create the remote branch.

But is that the correct way?

Yes.

Shouldn't a git push push all local changes to the remote repository?

Only if the branch was setup to track to remote branch in the first place. Your branch isn't tracking anything until you explicitly push it once.

Upvotes: 2

Related Questions