git config

git

इस्तेमाल

git config [--global] <key> [<value>]

git की सेटिंग पढ़ता और लिखता है; --global के बिना यह सिर्फ़ इसी repository में जाती है, नए clone को उसका पता नहीं होता।

आम विकल्प

विकल्पअर्थ
--globalwrite to ~/.gitconfig for every repository
--localwrite to .git/config, the default
--list --show-originprint every setting and the file it came from
--get <key>print one value
--unset <key>delete one setting
-eopen the config file in your editor

उदाहरण

git config --global user.email "me@example.com"

sets the address every future commit is signed with

git config --global init.defaultBranch main

new repositories start on main instead of master

git config --list --show-origin

shows which file each setting comes from

उलझन यह है कि पीछे लौटने के कई रूप हैं — ब्रांच का इशारा हटाना और उलटने वाला कमिट जोड़ना एक बात नहीं।

कैसे पढ़ें

  • बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
  • तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
  • विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।

आम सवाल

Q. git config क्या करता है?

git की सेटिंग पढ़ता और लिखता है; --global के बिना यह सिर्फ़ इसी repository में जाती है, नए clone को उसका पता नहीं होता।

Q. इसे कैसे लिखें?

git config [--global] <key> [<value>] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

Q. कितने विकल्प जानने लायक़ हैं?

यहाँ 6 दिए हैं; पूरी सूची man git में है। यह कमांड git में आती है।

मिलती-जुलती कमांड

man पेज: man git-config