Git Large File Storage (LFS)
In this page:
git lfs install
git lfs track "*.extension"
git add .gitattributes
Git LFS क्या है?
Git text files के लिए designed है। बड़ी binary files (जैसे videos, datasets, या graphics) store करना cloning धीमा कर देता है। Git LFS (Large File Storage) इन files को आपकी repository में lightweight, 1KB text pointer files से replace कर देता है, cookiescursor.com जैसे servers पर clone speeds को तेज़ रखते हुए।
उदाहरण: What is Git LFS?
git lfs install
Large Files Track करना
git lfs track "*.psd" (या कोई भी glob pattern) एक file type को LFS द्वारा handle होने के लिए register करता है, rule को एक .gitattributes file में लिखते हुए जो खुद repo में committed होती है — इसलिए एक बार कोई इसे set up कर दे, project clone करने वाला हर कोई automatically same LFS behavior पाता है।
उदाहरण: Tracking Large Files
git lfs track "*.psd"
git add .gitattributes
LFS Files Stage और Commit करना
tracking configured होने पर, git add और git commit exactly normally काम करते हैं — LFS behind the scenes matching files intercept करता है, उनका actual content LFS storage में upload करता है, और इसकी जगह regular Git history में एक छोटी pointer file (file के hash और size वाली) commit करता है।
उदाहरण: Staging and Committing LFS Files
git add design.psd
git commit -m "Add design file"
LFS Status Check करना
git lfs ls-files list करता है कि आपकी working directory में कौन सी tracked files इस समय LFS द्वारा managed हैं, और git lfs status दिखाता है कि उनमें से किनके pending changes हैं — यह confirm करने के लिए उपयोगी कि एक बड़ी file actually LFS से route हो रही है और गलती से एक regular blob की तरह commit नहीं हुई।
उदाहरण: Checking LFS Status
git lfs ls-files
git lfs status
LFS Repositories Clone करना
LFS इस्तेमाल करने वाली एक repository clone करते समय, Git पहले lightweight pointers download करता है, फिर automatically LFS storage server से actual बड़ी files fetch करता है। यह cloning process को तेज़ और efficient रखता है।
उदाहरण: Cloning LFS Repositories
git clone https://github.com/user/repo.git
- पहले से commit हो चुकने के बाद एक file को
git lfs trackसे track करना, जबकि पुराना version अभी भी एक normal file की तरह store है। .gitattributescommit करना भूल जाना, ताकि teammates उन files के लिए LFS इस्तेमाल न करें।- बिना Git LFS installed के clone करना, ताकि बड़ी files छोटी pointer text files की तरह दिखें।
Chapter Quiz — Complete all 8 topics to unlock
0/8 topics done
Complete these topics first: