
You can avoid steps f and g, if you use the below instead of command present in step a. This converts the Shallow Clone into Deep Clone with all the History and Branch details. git/config.įetch = +refs/heads/master:refs/remotes/origin/masterįetch = +refs/heads/*:refs/remotes/origin/* Fetch All Branches Comparing Local and Remote Branches Synchronizing a Local Branch with a Remote Branch The Half-Trained Puppy What Is git fetch, and What Does It Do The fetch command in Git downloads commits, files, and other information from a remote repository to your local repository, safely. [This Step can also be done manually by editing following line in. However, this doesn’t bring all the branches: The above command will convert the shallow clone to regular one.

git remote set-branches -add origin release-1. git remote set-branches -add origin remote-branch git fetch git checkout remote-branch You can also use wildcards for remote-branch, e.g.

This does a shallow clone (with the depth-option) only fetches only one single branch (at your requested depth). To add another remote branch to my local repository that was cloned using -single-branch, the following works for me. Note:- if your branch is up-to-date with remote branch, you will see the below.
Then, git pull originGit fetch a branch full#
Used the following steps to download the branch: (This downloads the shallow copy of the branch and then converts it into a Full Clone i.e bring complete branch and its history). Use git fetch to get all available branches. Two ways to achieve Shallow Clone to Deep Clone.
