Elad Benda
Elad Benda

Reputation: 36656

how to branch locally from remote branch using git

I have remote origin with branches a, b

and local branch a.

I have finished working on local-a, and pushed it to remote-a.

I now want to create a local branch b-myUserName based on remote b.

How do I do this?

Update

after trying to branch a remote branch to my workplace,

I get the following error:

**$ git checkout -b canc_el --track origin/canc**
error: The following untracked working tree files would be overwritten by checkout:
    src/iphone/FacebookSDK.framework/Headers
    src/iphone/FacebookSDK.framework/Resources
    src/iphone/FacebookSDK.framework/Versions/Current
    src/iphone/Xcode/Crashlytics.framework/Headers

Please move or remove them before you can switch branches.
Aborting

That's strange. I haven't removed them from tracking.

I want them to be overriden. I know nothing much about them.

What should I do?

Upvotes: 0

Views: 89

Answers (1)

kiheru
kiheru

Reputation: 6618

git checkout -b b-myUserName --track origin/b

or split to two commands:

git checkout origin/b
git checkout -b b-myUserName

Upvotes: 2

Related Questions