विज्ञापन

क्रिप्टो एक्सचेंज बोनस पाएँ

सिर्फ़ साइन अप करने पर मिलने वाले बोनस। शर्तें हर एक्सचेंज की घोषणा से ज्यों की त्यों ली गई हैं।

git restore

git

इस्तेमाल

git restore [--staged] [-s <commit>] <pathspec>

फ़ाइल की सामग्री लौटाने वाला git 2.23 का आदेश; डिफ़ॉल्ट रूप से यह working फ़ाइल को ऊपर लिख देता है और बिना commit बदलाव चले जाते हैं, जबकि --staged सिर्फ़ unstage करता है।

आम विकल्प

विकल्पअर्थ
--stagedunstage the file but keep your edits
--worktreereset the file on disk; this is the default
--staged --worktreeboth: throw the edits away and unstage
-s <commit>take the content from that commit instead of the index
-pchoose hunk by hunk

उदाहरण

git restore src/app.ts

wipes uncommitted edits to that file, with no way back

git restore --staged src/app.ts

takes it out of the staging area, edits intact

git restore -s HEAD~2 src/app.ts

brings back the version from two commits ago

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

कैसे पढ़ें

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

आम सवाल

Qgit restore क्या करता है?

फ़ाइल की सामग्री लौटाने वाला git 2.23 का आदेश; डिफ़ॉल्ट रूप से यह working फ़ाइल को ऊपर लिख देता है और बिना commit बदलाव चले जाते हैं, जबकि --staged सिर्फ़ unstage करता है।

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

git restore [--staged] [-s <commit>] <pathspec> — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man git-restore