bingjie2680
bingjie2680

Reputation: 7773

can not get new branch from github

my co-worker has just create a new branch in the git repository which we have been working for a while. but in my local repository, I am having a hard time to get the new branch and merge it into my local repos. I found this post: Only master branch is visible after cloning a Git repo, but it did not work for me.

what else can I try? please kindly help me, thanks a lot.

Upvotes: 1

Views: 430

Answers (1)

vergenzt
vergenzt

Reputation: 10367

The argument to git fetch is supposed to be a repository, not a branch.

$ git fetch origin
From https://github.com/...
 * [new branch]    newbranchname  -> origin/newbranchname

$ git checkout -b newbranchname origin/newbranchname
 Branch newbranchname set up to track remote branch newbranchname from origin.
 Switched to a new branch 'newbranchname'

You should now have a local copy of your coworker's branch from which you can git push and git pull to update.

Upvotes: 3

Related Questions