Reputation: 755
I have setup a secure git repo setup on my desktop which I am able to access and clone from anywhere. However after cloning the repository I can only see the master branch and not the new dev branch that I have created on my desktop (which is my git server). Just to be clear the dev branch on the server does not have any data yet, but I was atleast expecting to see that it exists, after cloning that repo on my laptop.
Please help!!
Upvotes: 1
Views: 416
Reputation: 129536
You need to push your branch up first from the original repo:
git push origin branchname
Then fetch from the new clone:
git fetch origin #origin is optional if that's the only remote you have
Now create and checkout the branch locally:
git checkout -t origin/branchname
Upvotes: 0
Reputation: 301117
After you do the clone, do:
git checkout -b dev origin/dev
This will create and switch to the dev branch.
If you are talking about having created the branch on the clone repo, do
git checkout <branch_name>
to switch to the branch.
Upvotes: 2
Reputation: 8976
You can see all the existing branches with :
git branch -a
For a basic repository (master branch only), the output is :
* master ---> local master branch
remotes/origin/master ---> remote master branch
After a simple git branch dev
, the output of git branch -a
should be :
dev ---> local dev branch
* master ---> local master branch
remotes/origin/master ---> remote master branch
If you want to create a branch on your remote repository :
git push origin <local branch name>:<remote branch name>
Or if you want to keep the name of the local branch :
git push origin <local branch name>
And git branch -a
should give :
dev ---> local dev branch
* master ---> local master branch
remotes/origin/dev ---> remote dev branch
remotes/origin/master ---> remote master branch
Upvotes: 1