2

Hey guys how would I checkout a specific branch from another remote address?

Thanks

hao
  • 197
  • 6

1 Answers1

5
git checkout -b abranch origin/abranch

would allow you to create your own local branch, starting from a remote called origin, for the remote branch abranch.

That supposes you have declared a remote (which is done automatically when you clone a remote repo, declaring 'origin' as the default name for referencing all refspecs from that repo in the remotes/origin namespace)

If you have already an 'origin' upstream repo from your original clone, but you want to add another repo as a source for your pull/push workflow, see git remote (i.e git remote add ...).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250