Reputation: 110113
I am working on a project and I created a repository with a master
branch. Someone who is working on it added a branch named new-branch
-- their code changes are in this branch.
However, when I clone the repository:
$ git clone [email protected]:me/my-repo.git
I can clone it successfully, but it only shows the master
branch. I do not know how I can view/get the new-branch
.
How would I pull this branch to my repository?
Upvotes: 20
Views: 23418
Reputation: 188
In my case, i cloned the Repo correctly but i was trying to find the branches in the internal folder. so i was unable to see any.
My Project has below folder structure.
ABC/
ABC_XYZ /
ABC_Core
ABC_Web
x
y
z
.....
so i was trying to check the branches in ABC_XYZ instead of ABC.
Upvotes: 0
Reputation: 992917
When you clone a repository, all remote branches are created as "remote tracking branches" in your repository. These aren't shown by default, but you can see these with:
git branch -a
If you do a git checkout new-branch
, git will find the remote tracking branch of the same name, automatically create a new local branch from the same commit, and switch to the new local branch.
For future work, the git fetch
command will update all the remote tracking branches with their latest commit from the remote.
Upvotes: 43