by Sai gowtham

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

  1. First, we need to clone the remote git repository by using the git clone command followed by the repository URL or ssh.
git clone <your-repo-url>
  1. Now, change your current working directory to the cloned repository folder.
cd my-cloned-project-folder
  1. Next, we need to list all available branches by using the git branch command followed by -a flag.
git branch -a

This above command will show you all available remote branches.

  1. 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.

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
26,545 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
221,520 students enrolled
44 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
114,575 students enrolled
21 hours of video content
View Course