hao
hao

Reputation: 197

Checking out remote git branch?

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

Thanks

Upvotes: 2

Views: 953

Answers (1)

VonC
VonC

Reputation: 1323203

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 ...).

Upvotes: 5

Related Questions