git push
git
इस्तेमाल
git push [-u] [--force-with-lease] <remote> <branch>आपके commit remote पर भेजता है; --force remote branch को ऊपर लिख देता है और दूसरों के commit तक मिटा सकता है, इसलिए --force-with-lease लगाएँ, जो remote बदल गया हो तो मना कर देता है।
आम विकल्प
| विकल्प | अर्थ |
|---|---|
| -u | set the upstream so later pushes need no arguments |
| --force-with-lease | force, but stop if the remote moved since your last fetch |
| -f | force: overwrite the remote branch, commits of others included |
| --tags | push tags as well, which push does not do on its own |
| --delete <branch> | delete the branch on the server |
| --all | push every local branch |
| -n | dry run |
उदाहरण
git push -u origin feature/loginpublishes the branch and remembers the pairing
git push --force-with-leasethe safe force, used after a rebase
git push origin --delete old-featureremoves the branch on the server
उलझन यह है कि पीछे लौटने के कई रूप हैं — ब्रांच का इशारा हटाना और उलटने वाला कमिट जोड़ना एक बात नहीं।
कैसे पढ़ें
- बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
- तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
- विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।
आम सवाल
Q. git push क्या करता है?
आपके commit remote पर भेजता है; --force remote branch को ऊपर लिख देता है और दूसरों के commit तक मिटा सकता है, इसलिए --force-with-lease लगाएँ, जो remote बदल गया हो तो मना कर देता है।
Q. इसे कैसे लिखें?
git push [-u] [--force-with-lease] <remote> <branch> — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।
Q. कितने विकल्प जानने लायक़ हैं?
यहाँ 7 दिए हैं; पूरी सूची man git में है। यह कमांड git में आती है।
मिलती-जुलती कमांड
man पेज: man git-push