Search code examples
gitgithubbranchgit-clone

When I clone my repository in my local system then it will show only one branch


I have two branches:
1. Master
2. Staging

All my commit available in staging branch but in master branch it have only necessary commit which I push using cherry-pick from staging branch.

Now the issue is, I have re-set up this repository in my local machine but when I clone this repo using git clone https:repository-url.git then it will create only one master branch and only appear master branch commit so how can I also clone my staging branch and their commit?

I already try to git checkout -b staging but it will make a copy from master branch.


Solution

  • git branch -r will show you all the local copies of the remote branches, such as origin/master and origin/staging. Just run git checkout staging (without the -b!) to create a local staging branch that tracks the remote one.