How to Create a Remote Git Branch?

Find out how to create a remote git branch

You can create a remote git branch using the following command:

# create new branch locally
git checkout -b <branch-name>

# push local branch to remote server and create remote branch
git push -u <remote-name> <branch-name>

By specifying the -u flag (or --set-upstream), the local branch will track the remote branch.

If you want to have a different name for the remote branch than the local one, then you can use the following command instead:

git push -u <remote-name> <local-branch-name>:<remote-branch-name>

Hope you found this post useful. It was published . Please show your love and support by sharing this post.