Clone a Specific Folder from a GitHub Repository (2024)

Clone a Specific Folder from a GitHub Repository (2)

Have you ever found yourself in a situation where you need to download an entire 10GB repository just to make a small change in a single file or add a new file to a particular folder? It can be quite the hassle and a space-consuming endeavor. However, there’s a more efficient way to handle this without cluttering your disk with unnecessary data. I’ll guide you through the process step by step.

  1. Copy the Clone URL

First, go to the repository on GitHub and copy the clone URL.

Clone a Specific Folder from a GitHub Repository (3)

2. Select a Local Folder

With the URL you can go to a folder where you want to clone the specific files of the repository and digit the follow commands:

Clone a Specific Folder from a GitHub Repository (4)

3. Navegate to the cloned empty repo

This will clone the repo but empty, go inside with the cd <FOLDER NAME> command

Clone a Specific Folder from a GitHub Repository (5)

4. Set Sparse

Inside the repo run this other command

Clone a Specific Folder from a GitHub Repository (6)

the sparse-checkout command just works on git version 2.25.0 so make sure you have your git version updated.

5. Select a Branch

Go to the branch you want clone the folder like develop branch, master, etc… In my case here I will use the master branch

Clone a Specific Folder from a GitHub Repository (7)

6. Cloning the specific folder

Now it’s time to download just the folder that you want, In my case I will download the “auth” folder in the repository, this folder is a subfolder of “src”, so replace this path for one that you want from your repository.

Clone a Specific Folder from a GitHub Repository (8)

And finally, this is the result:

Clone a Specific Folder from a GitHub Repository (9)

You can see that I cloned just the auth folder, but in the gitHub repository exist a lot of others folders and files

Clone a Specific Folder from a GitHub Repository (10)

And there you have it! You’ve successfully cloned just the specific folder, saving both time and disk space. Keep in mind that the GitHub repository may contain numerous other folders and files, but you’ve isolated what you need for your work. Feel free to make your changes, commit, and push as you would on any other day, all while keeping your disk tidy.

Clone a Specific Folder from a GitHub Repository (2024)
Top Articles
Restoration Ecology
SVG
Automated refuse, recycling for most residences; schedule announced | Lehigh Valley Press
Using GPT for translation: How to get the best outcomes
Immobiliare di Felice| Appartamento | Appartamento in vendita Porto San
30 Insanely Useful Websites You Probably Don't Know About
From Algeria to Uzbekistan-These Are the Top Baby Names Around the World
Wild Smile Stapleton
Puretalkusa.com/Amac
Concacaf Wiki
Programmieren (kinder)leicht gemacht – mit Scratch! - fobizz
House Of Budz Michigan
Quest Beyondtrustcloud.com
Convert 2024.33 Usd
Sizewise Stat Login
Accident On The 210 Freeway Today
Www.publicsurplus.com Motor Pool
Egizi Funeral Home Turnersville Nj
Red Cedar Farms Goldendoodle
Bocca Richboro
Craigslist Dubuque Iowa Pets
1979 Ford F350 For Sale Craigslist
Claio Rotisserie Menu
Tom Thumb Direct2Hr
Srjc.book Store
In hunt for cartel hitmen, Texas Ranger's biggest obstacle may be the border itself (2024)
Gt7 Roadster Shop Rampage Engine Swap
Fastpitch Softball Pitching Tips for Beginners Part 1 | STACK
Slv Fed Routing Number
School Tool / School Tool Parent Portal
Retire Early Wsbtv.com Free Book
Acadis Portal Missouri
Uc Santa Cruz Events
B.C. lightkeepers' jobs in jeopardy as coast guard plans to automate 2 stations
Walmart Car Service Near Me
Silicone Spray Advance Auto
Pike County Buy Sale And Trade
Autozone Battery Hold Down
Quaally.shop
Gabrielle Abbate Obituary
Arch Aplin Iii Felony
Greg Steube Height
Booknet.com Contract Marriage 2
877-552-2666
Market Place Tulsa Ok
Plasma Donation Greensburg Pa
Guy Ritchie's The Covenant Showtimes Near Look Cinemas Redlands
The Plug Las Vegas Dispensary
Renfield Showtimes Near Regal The Loop & Rpx
Affidea ExpressCare - Affidea Ireland
Latest Posts
Article information

Author: Reed Wilderman

Last Updated:

Views: 5903

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Reed Wilderman

Birthday: 1992-06-14

Address: 998 Estell Village, Lake Oscarberg, SD 48713-6877

Phone: +21813267449721

Job: Technology Engineer

Hobby: Swimming, Do it yourself, Beekeeping, Lapidary, Cosplaying, Hiking, Graffiti

Introduction: My name is Reed Wilderman, I am a faithful, bright, lucky, adventurous, lively, rich, vast person who loves writing and wants to share my knowledge and understanding with you.