0

Before start I want to tell you scenario. I have created gitlab account and uploaded three different projects. when I am using browser to see all branches I can see: a) master b)feature/bakend c)frontend but when I am running command from command prompt git branch * master

Now I am using another laptop (that soes not have local backup) and when I am doing clone operation it is creating local repository for one project only, then can you please tell me how should I clone my another projects? Thank you in advance.

  • Possible duplicate of [How do I list all remote branches in Git 1.7+?](https://stackoverflow.com/questions/3471827/how-do-i-list-all-remote-branches-in-git-1-7) – leopal Nov 18 '19 at 09:16
  • I hope you are on your master branch, seems like your local repository is not up to date with the master, try this: git fetch, it will update your local repo with the remote and after that execute git branch -a, it will show you the rest of the branches available in remote. – Shankar Saran Singh Nov 18 '19 at 09:18

2 Answers2

0

You're listing local branches, your branches currently only exist on the remote. You can use the checkout command to checkout a branch in the repository that doesn't have a local branch yet:

git checkout feature/bakend
Fredrik Schön
  • 4,888
  • 1
  • 21
  • 32
0

I think what you meant was you have a single repository with three different branches and you just want to be able to go to these three different branches in your newly cloned repository. This should be fairly simple.

Here is a general workflow:

git clone <your_repository_url>

This will download your remote repository to your local computer.

git status

This will show the current status of the repository including which branch you currently are.

git branch

This will list all the branches that are there within the repository. The branch name with '*' at the front is the one you are currently at. You should see all the branches you saw via the browser in the gitlab remote repository.

git checkout <branch_name>

This will help you move between branches. Eg if you want to move to frontend branch simply run :

git checkout frontend

Hope this helps.

bijaykumarpun
  • 677
  • 4
  • 9
  • git push origin frontend fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. – Aruna Patil Nov 18 '19 at 09:58
  • can you please tell me how could I change my current project repository to another project. I mean how I clone the another project – Aruna Patil Nov 18 '19 at 10:04
  • @ArunaPatil To clone another project, just run 'git clone in commandline in the directory you want the project to be downloaded. – bijaykumarpun Nov 18 '19 at 10:12