By default, when you clone a GutHub repository, you clone the “master” (or sometimes “main”) branch as well as all the other branches in the repository. However, there will undoubtably be a situation where you only want to make changes to one branch of the repository. The following command clones the repo and checks out to the branch you specify immediately.
git clone -b <branch-name> <repo-url>
However, if you don’t want to clone all of the files associated with all of the branches, you can use the following command to only download the files associated with your specified branch:
git clone -b <branch-name> --single-branch <repo-url>