Git push to a new remote branch

To push a local branch to a new remote branch, you can use the following command:

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

Here:

For example, if you want to push a local branch called feature/new-login-system to a new remote branch called feature/new-login-system on the remote repository origin, you would use the following command:

git push -u origin feature/new-login-system:feature/new-login-system

The -u flag stands for "set upstream" and it sets the tracking information for the branch. This means that subsequent git pull and git push commands will use the new remote branch as the default.

If you want to push a local branch to a new remote branch with a different name, you can use the following command:

git push -u origin <local-branch-name>:refs/heads/<remote-branch-name>

For example:

git push -u origin feature/new-login-system:refs/heads/feature/login-system

This will create a new remote branch called feature/login-system and push the local feature/new-login-system branch to it.

Note that if you want to push a local branch to an existing remote branch, you can simply use the following command:

git push origin <local-branch-name>

This will push the local branch to the existing remote branch with the same name.