आपको Git सहायता का उपयोग क्यों और कब करना चाहिए?
Git में कई कमांड और विकल्प हैं।
यदि आप भूल गए हैं कि कोई कमांड कैसे काम करती है या उसके विकल्पों के बारे में जानना चाहते हैं, तो आप Git की अंतर्निहित सहायता का उपयोग कर सकते हैं।
यह अपना टर्मिनल छोड़े बिना उत्तर प्राप्त करने का सबसे तेज़ तरीका है।
सहायता प्राप्त करने के लिए महत्वपूर्ण आदेश
git help <command>
किसी कमांड का मैन पेज देखें
git <command> --help
किसी आदेश के लिए सहायता देखें (ऊपर जैसा ही)
git <command> -h
विकल्पों का त्वरित सारांश देखें
git help --all
सभी संभावित Git कमांडों की सूची बनाएं
git help -g
मार्गदर्शिकाएँ और समीक्षाएँ सूचीबद्ध करें
किसी विशिष्ट कमांड के लिए सहायता देखें (git सहायता <कमांड>)
सभी विकल्पों और उदाहरणों सहित निर्दिष्ट कमांड के लिए पूरा मैनुअल पेज प्रदर्शित करता है:
उदाहरण: कमिट के लिए सहायता देखें
git help commit
GIT-COMMIT(1)
NAME
git-commit - Record changes to the repository
SYNOPSIS
git commit [options] [--] ...
DESCRIPTION
Stores the current contents of the index in a new commit
together with a log message from the user describing the changes.
...
यह कमांड आपके टर्मिनल में git कमिट के लिए संपूर्ण दस्तावेज़ खोलता है।
सहायता पृष्ठ देखते समय:
- नीचे स्क्रॉल करने के लिए तीर कुंजी या स्पेस का उपयोग करें और ऊपर स्क्रॉल करने के लिए b का उपयोग करें
- खोजने के लिए, / (उदाहरण के लिए, / विकल्प) के साथ एक शब्द टाइप करें, फिर अगले मिलान के लिए n टाइप करें
- किसी भी समय सहायता डिस्प्ले से बाहर निकलने के लिए q दबाएँ
--help के साथ सहायता देखें (git <command> --help)
यह git हेल्प <कमांड> की तरह काम करता है। अधिकांश उपयोगकर्ता इस प्रारूप को पसंद करते हैं:
उदाहरण: स्थिति के लिए सहायता देखें
git status --help
GIT-STATUS(1)
NAME
git-status - Show the working tree status
SYNOPSIS
git status [options] [--] [pathspec...]
DESCRIPTION
Displays paths that have differences between the index file and the current HEAD commit.
...
यह कमांड git स्टेटस के लिए मैनुअल पेज खोलता है।
-h (git <कमांड> -h) के साथ एक त्वरित सारांश देखें
टर्मिनल विंडो में कमांड के विकल्पों का संक्षिप्त सारांश प्रदर्शित करता है (पूरा मैनुअल नहीं खोलता):
उदाहरण: ऐड के लिए त्वरित सहायता
git add -h
usage: git add [options] [--] ...
-n, --dry-run dry run
-v, --verbose be verbose
-i, --interactive interactive picking
-p, --patch select hunks interactively
-e, --edit edit current diff and apply
-u, --update update tracked files
-A, --all add changes from all tracked and untracked files
...
यह कमांड आपको कमांड के उपलब्ध विकल्पों का संक्षिप्त विवरण देता है।
सभी Git कमांडों की सूची बनाएं (git सहायता --सभी)
आपके सिस्टम पर उपलब्ध प्रत्येक Git कमांड को सूचीबद्ध करता है, जिसे निम्न द्वारा वर्गीकृत किया गया है:
⚠️ चेतावनी:
यह आदेशों की एक बहुत लंबी सूची प्रदर्शित करेगा
उदाहरण
git help --all
See 'git help ' to read about a specific subcommand
Main Porcelain Commands
add Add file contents to the index
am Apply a series of patches from a mailbox
archive Create an archive of files from a named tree
bisect Use binary search to find the commit that introduced a bug
branch List, create, or delete branches
bundle Move objects and refs by archive
checkout Switch branches or restore working tree files
cherry-pick Apply the changes introduced by some existing commits
citool Graphical alternative to git-commit
clean Remove untracked files from the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
describe Give an object a human readable name based on an available ref
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
format-patch Prepare patches for e-mail submission
gc Cleanup unnecessary files and optimize the local repository
gitk The Git repository browser
grep Print lines matching a pattern
gui A portable graphical interface to Git
init Create an empty Git repository or reinitialize an existing one
log Show commit logs
maintenance Run tasks to optimize Git repository data
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
notes Add or inspect object notes
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
range-diff Compare two commit ranges (e.g. two versions of a branch)
rebase Reapply commits on top of another base tip
reset Reset current HEAD to the specified state
restore Restore working tree files
revert Revert some existing commits
rm Remove files from the working tree and from the index
shortlog Summarize 'git log' output
show Show various types of objects
sparse-checkout Initialize and modify the sparse-checkout
stash Stash the changes in a dirty working directory away
status Show the working tree status
submodule Initialize, update or inspect submodules
switch Switch branches
tag Create, list, delete or verify a tag object signed with GPG
worktree Manage multiple working trees
...
नोट:
यदि आप सूची दृश्य में फंस जाते हैं, तो सूची के अंत तक जाने के लिए SHIFT + G दबाएँ, फिर दृश्य से बाहर निकलने के लिए q दबाएँ।
सूची मार्गदर्शिकाएँ और टिप्पणियाँ (git help -g)
गहन शिक्षण के लिए मार्गदर्शकों और राय विषयों की एक सूची दिखाता है:
उदाहरण: मार्गदर्शिकाएँ और टिप्पणियाँ सूचीबद्ध करें
git help -g
The common Git guides are:
attributes Defining attributes per path
everyday Everyday Git With 20 Commands Or So
glossary A Git glossary of terms
revisions Specifying revisions and ranges for Git
...
यह कमांड Git की उन्नत अवधारणाओं और सर्वोत्तम प्रथाओं के बारे में सीखने के लिए बहुत अच्छा है।
समस्या समाधान
हेल्प व्यूअर से कैसे बाहर निकलें?
समाधान:सहायता पृष्ठ से बाहर निकलने के लिए q दबाएँ
सहायता पृष्ठ नहीं खुल रहा?
समाधान:त्वरित सारांश के लिए git <command> -h आज़माएँ
किसी शब्द को कैसे खोजें?
समाधान:सहायता व्यूअर में, / दबाएँ, फिर अपना खोज शब्द टाइप करें और Enter दबाएँ
सारांश
आपने अभी क्या सीखा:
- Git
- विशिष्ट आदेशों के लिए पूर्ण दस्तावेज़ीकरण कैसे देखें
- त्वरित कमांड विकल्प सारांश कैसे देखें
- सभी उपलब्ध Git कमांड कैसे खोजें
- गाइड और राय दस्तावेज़ों तक कैसे पहुँचें
- सहायता पृष्ठों को प्रभावी ढंग से कैसे नेविगेट करें
आगे क्या होगा?
अब आप जानते हैं कि Git हेल्पर कमांड का उपयोग कैसे करें! अगले पाठ में, हम सीखेंगे कि Git शाखाओं के साथ कैसे काम करें।