git update-index

git

इस्तेमाल

git update-index [--skip-worktree|--chmod=+x] <file>

index को सीधे बदलता है; ये निशान स्थानीय होते हैं और कभी push नहीं होते, और ट्रैक हो रही config फ़ाइल में अपने बदलाव बचाने वाला विकल्प --skip-worktree है, --assume-unchanged नहीं।

आम विकल्प

विकल्पअर्थ
--chmod=+xrecord the executable bit, useful from Windows
--skip-worktreelet you keep local edits to a tracked file
--no-skip-worktreeundo that
--assume-unchangedpromise you will not edit it, as a speed hint only
--no-assume-unchangedundo that
--refreshupdate stat information after a filesystem change

उदाहरण

git update-index --chmod=+x scripts/deploy.sh

stages the executable bit so CI can run it

git update-index --skip-worktree config/local.json

keeps your local edits out of every diff

git update-index --no-skip-worktree config/local.json

puts the file back under normal tracking

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

कैसे पढ़ें

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

आम सवाल

Q. git update-index क्या करता है?

index को सीधे बदलता है; ये निशान स्थानीय होते हैं और कभी push नहीं होते, और ट्रैक हो रही config फ़ाइल में अपने बदलाव बचाने वाला विकल्प --skip-worktree है, --assume-unchanged नहीं।

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

git update-index [--skip-worktree|--chmod=+x] <file> — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man git-update-index