khernik
khernik

Reputation: 2091

Checking out branch from origin

I have master and dev branches in origin in source tree, and I can't fetch them to local branches.

On the local machine these branches already exist - both master and dev - locally.

Trying to check out a branch from origin to local gives me the following error:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree checkout -b dev --track origin/dev 
fatal: A branch named 'dev' already exists.
Completed with errors, see above

How can I solve this?

Upvotes: 2

Views: 940

Answers (1)

Makoto
Makoto

Reputation: 106389

Once you've locally created the branch, all you'd need to do is pull from it instead of checking it out again.

Use git checkout <branch> && git pull to accomplish this.

Upvotes: 2

Related Questions