When you use git and create a local branch:

git checkout -b branch_name

And push all your work using git push. Usually you will be prompted from git to define the remote name for the tracking of this branch (normally you use the same name branch_name) :

git push --set-upstream origin branch_name

This will push your branch to a remote branch called branch_name on your git server.

Though in some case you need to change the remote branch followed in order to push some work :

  • Using git v1.8.0 or later:

    git branch branch_name --set-upstream-to your_new_remote/branch_name

  • Or you can use the -u switch:

    git branch branch_name -u your_new_remote/branch_name

  • Using git v1.7.12 or earlier:

    git branch --set-upstream branch_name your_new_remote/branch_name


Share


The Hot Code
© 2025, All Rights Reserved.

Quick Links

Social Media