亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
characters

命名

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]           [-l | --files-with-matches] [-L | --files-without-match]           [(-O | --open-files-in-pager) [<pager>]]           [-z | --null]           [-c | --count] [--all-match] [-q | --quiet]           [--max-depth <depth>]           [--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>…]

描述

在工作樹中跟蹤文件中查找指定的模式,在索引文件中注冊的斑點或給定樹對象中的斑點。模式是由換行符分隔的一個或多個搜索表達式的列表。作為搜索表達式的空字符串與所有行匹配。

組態(tài)

grep.lineNumber

如果設置為 true ,則-n默認啟用選項。

grep.patternType

設置默認的匹配行為。使用值basicextended,fixed,或perl將啟用--basic-regexp,--extended-regexp,--fixed-strings,或--perl-regexp相應的選項,而值default將返回到默認匹配行為。

grep.extendedRegexp

如果設置為 true,則--extended-regexp默認啟用選項。當該grep.patternType選項設置為非時,該選項將被忽略default。

grep.threads

要使用的 grep 工作線程數(shù)。如果未設置(或設置為0),則默認使用8個線程(現(xiàn)在)。

grep.fullName

如果設置為 true ,則--full-name默認啟用選項。

grep.fallbackToNoIndex

如果設置為 true ,則回退到 git grep --no-index,如果 git grep 在 git 存儲庫之外執(zhí)行。默認為 false 。

選項

--cached

搜索工作樹中的追蹤文件,而不是搜索索引文件中注冊的斑點。

--no-index

搜索當前目錄中不受 Git 管理的文件。

--untracked

除了在工作樹中跟蹤文件中搜索外,還可以在未跟蹤文件中搜索。

--no-exclude-standard

通過不尊重.gitignore機制來搜索被忽略的文件。只用于--untracked。

--exclude-standard

不要關注通過.gitignore機制指定的忽略文件。僅在使用當前目錄搜索文件時有用--no-index

--recurse-submodules

遞歸搜索已在存儲庫中初始化并檢出的每個子模塊。當與 <tree> 選項結合使用時,所有子模塊輸出的前綴將是父項目的 <tree> 對象的名稱。

--parent-basename <basename>

僅限內(nèi)部使用。為了使用 --recurse-submodules 選項產(chǎn)生統(tǒng)一的輸出,可以使用此選項將父級的 <tree> 對象的基名稱提供給子模塊,以便子模塊可以將其輸出與父級名稱相加,而不是使用 SHA1 子模塊。

-a   --text

像處理文本一樣處理二進制文件。

--textconv

尊重 textconv 過濾器設置。

--no-textconv

不要兌現(xiàn) textconv 過濾器設置。這是默認設置。

-i   --ignore-case

忽略模式和文件之間的大小寫區(qū)別。

-I

不匹配二進制文件中的模式。

--max-depth <depth>

對于命令行中給出的每個 <pathspec> ,最多下降 <depth> 級別的目錄。負值意味著沒有限制。如果 <pathspec> 包含活動通配符,則忽略此選項。換句話說,如果 “a *” 匹配名為 “a *” 的目錄,則“*”的字面匹配如此 -  max-depth 仍然有效。

-w   --word-regexp

僅在字邊界處匹配模式(或者從一行的開始處開始,或者以非單詞字符開頭;結束于一行的末尾或后面跟著一個非單詞字符)。

-v   --invert-match

選擇不匹配的行。

-h   -H

默認情況下,該命令顯示每個匹配的文件名。-h選項用于抑制此輸出。-H是否有完整性,除了-h在命令行中早先給出的覆蓋之外,不會執(zhí)行任何操作。

--full-name

從子目錄運行時,該命令通常會輸出相對于當前目錄的路徑。該選項強制相對于項目頂部目錄輸出路徑。

-E   --extended-regexp   -G   --basic-regexp

對于模式使用 POSIX 擴展/基本正則表達式。默認是使用基本的正則表達式。

-P   --perl-regexp

為模式使用 Perl 兼容的正則表達式。

對這些類型的正則表達式的支持是可選的編譯時間依賴性。如果 Git 沒有編譯支持它們,提供這個選項會導致它失效。

-F   --fixed-strings

使用固定字符串模式(不要將模式解釋為正則表達式)。

-n   --line-number

在行號前加上匹配的行。

-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未指定,將使用默認尋呼機(請參閱core.pager git-config [1] )。

-z   --null

輸出 \ 0 而不是通常跟在文件名后的字符。

-c   --count

顯示匹配的行數(shù),而不是顯示每條匹配的行。

--color=<when>

顯示結果為彩色。該值必須 always(默認),never 或 auto 。

--no-color

關閉匹配突出顯示,即使配置文件將默認設置為彩色輸出。和--color=never一樣。

--break

在不同文件的匹配之間打印空行。

--heading

在文件的上方顯示文件名,而不是在每個顯示的行的開頭。

-p   --show-function

顯示包含匹配函數(shù)名稱的上一行,除非匹配行是函數(shù)名稱本身。該名稱的確定方式與git diff制作補丁大小標頭的方式相同(請參閱Defining a custom hunk-header gitattributes [5])。

-<num>   -C <num>   --context <num>

顯示 <num> 前導和尾部線條,并放置包含--連續(xù)的匹配組之間的線條。

-A <num>   --after-context <num>

顯示 <num> 尾隨線,并--在連續(xù)的匹配組之間放置一行。

-B <num>   --before-context <num>

顯示 <num> 引出線,并--在相鄰的匹配組之間放置一行。

-W   --function-context

顯示前一行中包含函數(shù)名稱的周圍文本,直到下一個函數(shù)名稱之前的文本,從而有效地顯示找到匹配的整個函數(shù)。

--threads <num>

要使用的 grep 工作線程數(shù)。參見grep.threadsCONFIGURATION獲取更多信息。

-f <file>

從 <file> 中讀取模式,每行一個。

-e

下一個參數(shù)是模式。這個選項必須用于模式的開頭,-并且應該在將用戶輸入傳遞給 grep 的腳本中使用。多個模式組合在一起or。

--and   --or   --not   ( … )

指定如何使用布爾表達式組合多個模式。--or是默認的運營商。--and--or優(yōu)先。-e必須用于所有模式。

--all-match

將多個模式表達式結合使用時--or,會指定此標志以將匹配限制為具有與其匹配的所有行的文件。

-q   --quiet

不要輸出匹配的行; 取而代之的是,當狀態(tài)0出現(xiàn)匹配時退出,當不存在時退出非零狀態(tài)。

<tree>…

而不是在工作樹中搜索跟蹤文件,搜索給定樹中的斑點。

--

表示選項結束; 其余的參數(shù)是 <pathspec> 限制器。

<pathspec>…

如果給定,則將搜索限制為至少匹配一個模式的路徑。兩個前導路徑匹配并支持 glob(7)模式。

有關 <pathspec> 語法的更多詳細信息,請參閱pathspec gitglossary [7]中的條目。

例子

git grep 'time_t' -- '*.[ch]'

查找time_t在所有跟蹤的 .c 和 .h 文件在工作目錄及其子目錄。

git grep -e '#define' --and \( -e MAX_PATH -e PATH_MAX \)

查找具有#define的線,要么是MAX_PATHPATH_MAX

git grep --all-match -e NODE -e Unexpected

查找具有NODEUnexpected兩者匹配的行的文件。

git grep solution -- :^Documentation

尋找solution,不包括Documentation中的文件。

Previous article: Next article: