How Do I Create a Remote Git Branch?

Better Stack Team
Updated on June 24, 2024

To create a remote Git branch, you typically need to follow these steps:

Step 1: Create a Local Branch

First, create a new branch locally using the git checkout -b command:

git checkout -b <branch-name>

Replace <branch-name> with the name you want to give to your new branch.

Step 2: Push the Local Branch to the Remote Repository

Next, push the newly created local branch to the remote repository using the git push command:

git push -u origin <branch-name>

Replace <branch-name> with the name of your local branch.

The -u option sets up tracking so that subsequent git pull and git push commands know which remote branch to pull from or push to without specifying it explicitly.


  • Ensure that you have write permissions to push changes to the remote repository.
  • It's common to create a remote branch immediately after creating a local branch to avoid confusion and to make it available to collaborators.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github