<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # git-grep > 原文: [https://git-scm.com/docs/git-grep](https://git-scm.com/docs/git-grep) ## 名稱 git-grep - 打印與圖案匹配的線條 ## 概要 ``` git grep [-a | --text] [-I] [--textconv] [-i | --ignore-case] [-w | --word-regexp] [-v | --invert-match] [-h|-H] [--full-name] [-E | --extended-regexp] [-G | --basic-regexp] [-P | --perl-regexp] [-F | --fixed-strings] [-n | --line-number] [--column] [-l | --files-with-matches] [-L | --files-without-match] [(-O | --open-files-in-pager) [<pager>]] [-z | --null] [ -o | --only-matching ] [-c | --count] [--all-match] [-q | --quiet] [--max-depth <depth>] [--[no-]recursive] [--color[=<when>] | --no-color] [--break] [--heading] [-p | --show-function] [-A <post-context>] [-B <pre-context>] [-C <context>] [-W | --function-context] [--threads <num>] [-f <file>] [-e] <pattern> [--and|--or|--not|(|)|-e <pattern>…?] [--recurse-submodules] [--parent-basename <basename>] [ [--[no-]exclude-standard] [--cached | --no-index | --untracked] | <tree>…?] [--] [<pathspec>…?] ``` ## 描述 在工作樹中的跟蹤文件中查找指定的模式,在索引文件中注冊的blob或給定樹對象中的blob。模式是由換行符分隔的一個或多個搜索表達式的列表。搜索表達式匹配所有行的空字符串。 ## 組態 ``` grep.lineNumber ``` 如果設置為true,則默認啟用`-n`選項。 ``` grep.column ``` 如果設置為true,則默認啟用`--column`選項。 ``` grep.patternType ``` 設置默認匹配行為。使用 _basic_ ,_擴展_,_固定_或 _perl_ 的值將啟用`--basic-regexp`,`--extended-regexp`,`--fixed-strings` ,或`--perl-regexp`選項相應,而值_默認_將返回默認匹配行為。 ``` grep.extendedRegexp ``` 如果設置為true,則默認啟用`--extended-regexp`選項。當`grep.patternType`選項設置為_默認值_以外的值時,將忽略此選項。 ``` grep.threads ``` 要使用的grep工作線程數。如果未設置(或設置為0),則默認使用8個線程(暫時)。 ``` grep.fullName ``` 如果設置為true,則默認啟用`--full-name`選項。 ``` grep.fallbackToNoIndex ``` 如果設置為true,如果git grep在git存儲庫之外執行,則回退到git grep --no-index。默認為false。 ## OPTIONS ``` --cached ``` 不是搜索工作樹中的跟蹤文件,而是搜索索引文件中注冊的blob。 ``` --no-index ``` 搜索當前目錄中不由Git管理的文件。 ``` --untracked ``` 除了搜索工作樹中的跟蹤文件外,還可以搜索未跟蹤的文件。 ``` --no-exclude-standard ``` 同時通過不遵守`.gitignore`機制來搜索被忽略的文件。僅適用于`--untracked`。 ``` --exclude-standard ``` 不要注意通過`.gitignore`機制指定的忽略文件。僅在使用`--no-index`搜索當前目錄中的文件時有用。 ``` --recurse-submodules ``` 遞歸搜索已在存儲庫中初始化和檢出的每個子模塊。當與&lt; tree&gt;組合使用時選項所有子模塊輸出的前綴將是父項目的&lt; tree&gt;的名稱。賓語。 ``` -a ``` ``` --text ``` 處理二進制文件就像它們是文本一樣。 ``` --textconv ``` 尊重textconv過濾器設置。 ``` --no-textconv ``` 不要尊重textconv過濾器設置。這是默認值。 ``` -i ``` ``` --ignore-case ``` 忽略模式和文件之間的大小寫差異。 ``` -I ``` 與二進制文件中的模式不匹配。 ``` --max-depth <depth> ``` 對于每個&lt; pathspec&gt;在命令行上給出,最多下降&lt; depth&gt;目錄級別。值-1表示沒有限制。如果&lt; pathspec&gt ;,則忽略此選項包含活動的通配符。換句話說,如果“a *”匹配名為“a *”的目錄,則“*”字面匹配,因此--max-depth仍然有效。 ``` -r ``` ``` --recursive ``` 與`--max-depth=-1`相同;這是默認值。 ``` --no-recursive ``` 與`--max-depth=0`相同。 ``` -w ``` ``` --word-regexp ``` 僅在單詞邊界處匹配模式(從行的開頭開始,或者以非單詞字符開頭;在行的末尾結束或后跟非單詞字符)。 ``` -v ``` ``` --invert-match ``` 選擇不匹配的行。 ``` -h ``` ``` -H ``` 默認情況下,該命令顯示每個匹配的文件名。 `-h`選項用于抑制此輸出。 `-H`是完整性的,除了它覆蓋了之前在命令行中給出的`-h`之外什么都不做。 ``` --full-name ``` 從子目錄運行時,該命令通常輸出相對于當前目錄的路徑。此選項強制路徑相對于項目頂級目錄輸出。 ``` -E ``` ``` --extended-regexp ``` ``` -G ``` ``` --basic-regexp ``` 使用POSIX擴展/基本正則表達式來表示模式。默認是使用基本正則表達式。 ``` -P ``` ``` --perl-regexp ``` 對模式使用與Perl兼容的正則表達式。 對這些類型的正則表達式的支持是可選的編譯時依賴性。如果Git沒有編譯并支持它們,那么提供此選項將導致它死亡。 ``` -F ``` ``` --fixed-strings ``` 對模式使用固定字符串(不要將模式解釋為正則表達式)。 ``` -n ``` ``` --line-number ``` 將行號前綴為匹配行。 ``` --column ``` 從匹配行的開頭開始對第一個匹配的1索引字節偏移進行前綴。 ``` -l ``` ``` --files-with-matches ``` ``` --name-only ``` ``` -L ``` ``` --files-without-match ``` 不顯示每個匹配的行,而是僅顯示包含(或不包含)匹配的文件的名稱。為了更好地與 _git diff_ 兼容,`--name-only`是`--files-with-matches`的同義詞。 ``` -O[<pager>] ``` ``` --open-files-in-pager[=<pager>] ``` 打開尋呼機中的匹配文件(不是 _grep_ 的輸出)。如果尋呼機恰好是“較少”或“vi”,并且用戶僅指定了一個模式,則第一個文件將自動定位在第一個匹配位置。 `pager`參數是可選的;如果指定,它必須粘在沒有空格的選項上。如果未指定`pager`,將使用默認尋呼機(參見 [git-config [1]](https://git-scm.com/docs/git-config) 中的`core.pager`)。 ``` -z ``` ``` --null ``` 輸出\ 0而不是通常在文件名后面的字符。 ``` -o ``` ``` --only-matching ``` 僅打印匹配行的匹配(非空)部分,每個此類部分位于單獨的輸出行上。 ``` -c ``` ``` --count ``` 而不是顯示每個匹配的行,而是顯示匹配的行數。 ``` --color[=<when>] ``` 顯示彩色火柴。該值必須始終為(默認值),never或auto。 ``` --no-color ``` 關閉匹配突出顯示,即使配置文件提供默認的顏色輸出。與`--color=never`相同。 ``` --break ``` 在不同文件的匹配項之間打印空行。 ``` --heading ``` 在該文件中的匹配項上方顯示文件名,而不是在每個顯示的行的開頭。 ``` -p ``` ``` --show-function ``` 顯示包含匹配函數名稱的上一行,除非匹配行是函數名稱本身。名稱的確定方式與 _git diff_ 計算出補丁程序塊標題的方式相同(參見_在 [gitattributes [5]](https://git-scm.com/docs/gitattributes) 中定義自定義的hunk-header_ )。 ``` -<num> ``` ``` -C <num> ``` ``` --context <num> ``` 顯示&lt; num&gt;前導和尾隨行,并在連續的匹配組之間放置包含`--`的行。 ``` -A <num> ``` ``` --after-context <num> ``` 顯示&lt; num&gt;尾隨行,并在連續的匹配組之間放置一行包含`--`。 ``` -B <num> ``` ``` --before-context <num> ``` 顯示&lt; num&gt;引導線,并在連續的匹配組之間放置包含`--`的行。 ``` -W ``` ``` --function-context ``` 顯示上一行中包含函數名稱的周圍文本,直到下一個函數名稱之前的文本,有效地顯示了找到匹配項的整個函數。 ``` --threads <num> ``` 要使用的grep工作線程數。有關詳細信息,請參見 _CONFIGURATION_ 中的`grep.threads`。 ``` -f <file> ``` 從&lt; file&gt;中讀取模式,每行一個。 ``` -e ``` 下一個參數是模式。此選項必須用于以`-`開頭的模式,并且應該在將用戶輸入傳遞給grep的腳本中使用。多個模式由_或_組合。 ``` --and ``` ``` --or ``` ``` --not ``` ``` ( …? ) ``` 指定如何使用布爾表達式組合多個模式。 `--or`是默認運算符。 `--and`的優先級高于`--or`。 `-e`必須用于所有模式。 ``` --all-match ``` 當給出多個模式表達式與`--or`組合時,指定此標志以限制匹配到具有匹配所有這些行的行的文件。 ``` -q ``` ``` --quiet ``` 不輸出匹配的線;相反,當匹配時退出狀態0,當沒有匹配時退出非零狀態。 ``` <tree>…? ``` 不是搜索工作樹中的跟蹤文件,而是搜索給定樹中的blob。 ``` -- ``` 表示選項的結束;其余參數是&lt; pathspec&gt;限制器。 ``` <pathspec>…? ``` 如果給定,則將搜索限制為與至少一個模式匹配的路徑。兩個前導路徑匹配,并支持glob(7)模式。 有關&lt; pathspec&gt;的詳細信息語法,請參閱 [gitglossary [7]](https://git-scm.com/docs/gitglossary) 中的 _pathspec_ 條目。 ## 例子 ``` git grep 'time_t' -- '*.[ch]' ``` 在工作目錄及其子目錄中的所有跟蹤的.c和.h文件中查找`time_t`。 ``` git grep -e '#define' --and \( -e MAX_PATH -e PATH_MAX \) ``` 查找具有`#define`和`MAX_PATH`或`PATH_MAX`的行。 ``` git grep --all-match -e NODE -e Unexpected ``` 在具有與兩者匹配的行的文件中查找具有`NODE`或`Unexpected`的行。 ``` git grep solution -- :^Documentation ``` 查找`solution`,不包括`Documentation`中的文件。 ## GIT 部分 [git [1]](https://git-scm.com/docs/git) 套件
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看