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>
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.