Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

How do I create a remote Git branch?

I created a local branch. How do I push it to the remote server?

UPDATE: I have written a simpler answer for Git 2.0 here.

Answer

Cancel
4
  • 1
    Doing this completely confused my Visual Studio to the point where it wouldn't start up correctly. The Team Explorer wouldn't load at all, but everything else went bonkers throwing errors also. Just FYI.
    – Josh
    Jun 27, 2016 at 20:04
  • This sounds like it should work, but when I actually tried it, the our gitlab server didn't recognise the result as a branch.
    – JosephH
    Nov 25, 2016 at 18:25
  • What branch is foo branched off of on the remote? What if I wanted to foo to branch off of foo2? Is that possible? Thank you.
    – user674669
    Sep 8, 2017 at 21:33
  • 1
    It works on gerrit server as well, creating a new branch on the remote that didn't exist before this command.
    – MichaelZ
    Aug 9, 2019 at 18:23