Hi Friends,
We are using Gitlab free edition. I want to take the backups all branches in a repository. If I use “git clone” command, its taking only master branch. Please help me by providing the commands to clone all branches at a time.
Thanks,
Ravi Reddy
snim2
March 15, 2021, 9:04pm
2
Hi @ravi.reddy
Until you checkout a branch, it will not appear in git branch
, but the branches are there! For example if I clone one of the GitLab repos:
$ git clone git@gitlab.com:gitlab-org/gitlab-triage
Cloning into 'gitlab-triage'...
remote: Enumerating objects: 528, done.
remote: Counting objects: 100% (528/528), done.
remote: Compressing objects: 100% (196/196), done.
remote: Total 3409 (delta 283), reused 504 (delta 273), pack-reused 2881
Receiving objects: 100% (3409/3409), 545.64 KiB | 1.94 MiB/s, done.
Resolving deltas: 100% (1744/1744), done.
I then need to use git branch --all
or -a
to see the remote branches:
$ git branch -a
* master
remotes/origin/155-new-condition-target_branch-for-merge-requests
remotes/origin/167-api-support-for-forbidden_labels
remotes/origin/189-escape-encode-the-query-string
remotes/origin/196-source-project-for-the-summaries-rules
remotes/origin/208-1-11-0-doesn-t-work-with-labels-containing-spaces
remotes/origin/HEAD -> origin/master
remotes/origin/add-graphql-support
remotes/origin/bump-to-0.7.0
remotes/origin/bump-to-1.0.0
remotes/origin/contribute-link
remotes/origin/echo-paths
remotes/origin/expose-rate-limit-headers
...
If I checkout a branch:
$ git checkout release-1.11.1
Branch 'release-1.11.1' set up to track remote branch 'release-1.11.1' from 'origin'.
Switched to a new branch 'release-1.11.1'
…then it appears in git branch
:
$ git branch
master
* release-1.11.1
$
HTH,
Sarah