git commit
git
इस्तेमाल
git commit [-a] -m "<message>"staging में रखी चीज़ों को एक commit के रूप में दर्ज करता है; -a सिर्फ़ पहले से ट्रैक हो रही फ़ाइलें लेता है, नई फ़ाइलें छूट जाती हैं।
आम विकल्प
| विकल्प | अर्थ |
|---|---|
| -m "<msg>" | give the message on the command line |
| -a | stage modified tracked files first; new files are skipped |
| --amend | replace the previous commit instead of adding one |
| --no-edit | keep the old message, used with --amend |
| --fixup=<commit> | mark it to be folded into <commit> by rebase --autosquash |
| -S | sign the commit with GPG |
| --allow-empty | commit with nothing staged |
उदाहरण
git commit -m "fix login redirect"records what is staged
git commit -a -m "typo"stages tracked edits and commits in one step
git commit --amend --no-editfolds the staged change into the last commit, keeping its message
उलझन यह है कि पीछे लौटने के कई रूप हैं — ब्रांच का इशारा हटाना और उलटने वाला कमिट जोड़ना एक बात नहीं।
कैसे पढ़ें
- बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
- तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
- विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।
आम सवाल
Q. git commit क्या करता है?
staging में रखी चीज़ों को एक commit के रूप में दर्ज करता है; -a सिर्फ़ पहले से ट्रैक हो रही फ़ाइलें लेता है, नई फ़ाइलें छूट जाती हैं।
Q. इसे कैसे लिखें?
git commit [-a] -m "<message>" — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।
Q. कितने विकल्प जानने लायक़ हैं?
यहाँ 7 दिए हैं; पूरी सूची man git में है। यह कमांड git में आती है।
मिलती-जुलती कमांड
man पेज: man git-commit