git merge
git
इस्तेमाल
git merge [--no-ff|--squash] <branch>दूसरी branch का काम मौजूदा branch में मिला देता है; --squash कोई merge दर्ज नहीं करता, इसलिए git उस branch को बाद में भी unmerged मानता रहता है।
आम विकल्प
| विकल्प | अर्थ |
|---|---|
| --no-ff | always record a merge commit, even when a fast-forward was possible |
| --ff-only | refuse unless it can fast-forward |
| --squash | stage the combined change without committing or recording a merge |
| --abort | undo a merge that stopped on conflicts |
| --continue | finish after you resolved the conflicts |
| -X ours|theirs | auto-resolve conflicting hunks one way |
| --no-commit | merge but leave the commit to you |
उदाहरण
git merge --no-ff feature/loginkeeps the branch visible in history
git merge --abortgets you back to before the conflicted merge
git merge --squash feature/loginone flat change, staged; you still have to commit
उलझन यह है कि पीछे लौटने के कई रूप हैं — ब्रांच का इशारा हटाना और उलटने वाला कमिट जोड़ना एक बात नहीं।
कैसे पढ़ें
- बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
- तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
- विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।
आम सवाल
Q. git merge क्या करता है?
दूसरी branch का काम मौजूदा branch में मिला देता है; --squash कोई merge दर्ज नहीं करता, इसलिए git उस branch को बाद में भी unmerged मानता रहता है।
Q. इसे कैसे लिखें?
git merge [--no-ff|--squash] <branch> — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।
Q. कितने विकल्प जानने लायक़ हैं?
यहाँ 7 दिए हैं; पूरी सूची man git में है। यह कमांड git में आती है।
मिलती-जुलती कमांड
man पेज: man git-merge