git init
git
इस्तेमाल
git init [-b <branch>] [<directory>]किसी फ़ोल्डर को नया git repository बना देता है; सिर्फ़ init से कोई फ़ाइल ट्रैक नहीं होती, add और commit अलग से करने पड़ते हैं।
आम विकल्प
| विकल्प | अर्थ |
|---|---|
| -b <name> | name the first branch, e.g. main |
| --bare | repository with no working tree, for a server |
| --template=<dir> | copy hooks and files from a template directory |
| --separate-git-dir=<dir> | keep the .git directory somewhere else |
| -q | print nothing but errors |
उदाहरण
git initturns the current folder into a repository by creating .git
git init -b main my-appcreates my-app/ with its first branch named main
git init --separate-git-dir=~/gitdirs/app.gitkeeps the .git directory elsewhere and leaves a pointer file
उलझन यह है कि पीछे लौटने के कई रूप हैं — ब्रांच का इशारा हटाना और उलटने वाला कमिट जोड़ना एक बात नहीं।
कैसे पढ़ें
- बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
- तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
- विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।
आम सवाल
Q. git init क्या करता है?
किसी फ़ोल्डर को नया git repository बना देता है; सिर्फ़ init से कोई फ़ाइल ट्रैक नहीं होती, add और commit अलग से करने पड़ते हैं।
Q. इसे कैसे लिखें?
git init [-b <branch>] [<directory>] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।
Q. कितने विकल्प जानने लायक़ हैं?
यहाँ 5 दिए हैं; पूरी सूची man git में है। यह कमांड git में आती है।
मिलती-जुलती कमांड
man पेज: man git-init