How to clone all branches from a remote git repository
In this tutorial, we are going to learn about how to clone all branches from a remote git repository.
Cloning all remote branches
- First, we need to clone the remote git repository by using the
git clonecommand followed by the repository URL or ssh.
git clone <your-repo-url>
- Now, change your current working directory to the cloned repository folder.
- Next, we need to list all available branches by using the git branch command followed by
git branch -a
This above command will show you all available remote branches.
- At final we can move to the available branches by using the “git checkout” command.
git checkout <branch-name>
If the branch is available remotely git starts tracking its changes.