Create new branch on remote
To create a new branch on a remote repository, you can use the following Git commands:
-
Checkout to the remote branch:
git checkout -t origin/<new-branch-name>
Replace
<new-branch-name>
with the name of the new branch you want to create. -
Create a new branch:
git branch <new-branch-name>
This will create a new local branch with the same name as the remote branch.
-
Push the new branch to the remote repository:
git push origin <new-branch-name>
This will create a new branch on the remote repository with the same name as the local branch.
Alternatively, you can use the following command to create a new branch and push it to the remote repository in one step:
git push origin --set-upstream <new-branch-name>
This will create a new branch on the remote repository and set the upstream tracking information for the local branch.
Note: Make sure you are in the correct directory and have the correct remote repository URL set in your Git configuration before running these commands.