What is Git
Git is a distributed version control system designed to track changes to a project (code) in software development. It is intended to enforce coordination, collaboration, speed, and efficiency among developers.
GitHub, on the other hand, is a web-based hosting service for version control using Git.
How to clone a Git Repository
Git Clone https://github.com/deadwin19/nest-rest-mongo-boilerplate.git
This gives you access to all branches in this repository and you can easily toggle between different branches and see the files.
You can use following command to change your local branch
git branch -a
How to Clone a Specific Branch
git clone --branch <branchname> <remote-repo-url>
git clone -b <branchname> <remote-repo-url>
With Option One, you will fetch all the branches in the repository but checkout to the one that you specified, and that branch becomes the configured local branch for
git push and
git clone --branch <branchname> --single-branch <remote-repo-url>
git clone -b <branchname> --single-branch <remote-repo-url>
Above step performs the same action as option one, except that it will only fetch files from the specified branch without fetching other branches.
Git Clone for Single Branch saves good amount of disk space specially when you have to work on only specific branch.
If you liked the solution, please hit the Clap button or comment if you have any suggestion or feedback.
Top comments (0)