git checkout branch on different remote
# First fetch all new_remote refs
git fetch new_remote
# Then
git checkout -b <branchname> --track new_remote/<branchname>
git checkout branch on different remote
# First fetch all new_remote refs
git fetch new_remote
# Then
git checkout -b <branchname> --track new_remote/<branchname>
switch to a different remote branch git
#Below is my method to switch and work for a remote branch of a git repository.
#Have a look for all the branches first, just input following command in the terminal:
$ git branch --all
#And then you will see the all the branches on local and remote. Something like this:
*master
remotes/origin/develop
remotes/origin/master
remotes/origin/web
remotes/origin/app
#Let's pretend you want to switch to the remotes/origin/develop branch. Type following:
$ git checkout remotes/origin/develop
# Then type git branch --all again to find this:
*(detached from remotes/origin/develop)
master
remotes/origin/develop
remotes/origin/master
remotes/origin/web
remotes/origin/app
# And then just do:
$ git checkout -b develop
#From now on, you are working on the remotes/origin/develop branch exactly.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us