亚洲国产日韩欧美一区二区三区,精品亚洲国产成人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

名稱(chēng)

gitignore  - 指定忽略有意未被跟蹤的文件

概要

$HOME/.config/git/ignore, $GIT_DIR/info/exclude, .gitignore

描述

gitignore文件指定 Git 應(yīng)該忽略的故意未記錄的文件。Git 已經(jīng)跟蹤的文件不受影響; 有關(guān)詳細(xì)信息,請(qǐng)參閱下面的注釋。

gitignore文件中的每一行都指定一個(gè)模式。在決定是否忽略路徑時(shí),Git 通常會(huì)檢查gitignore來(lái)自多個(gè)來(lái)源的模式,并按以下優(yōu)先級(jí)順序從高到低(在一個(gè)優(yōu)先級(jí)內(nèi),最后一個(gè)匹配模式?jīng)Q定結(jié)果):

  • 從命令行為支持它們的命令讀取模式。

  • 從與.gitignore文件路徑相同的目錄或任何父目錄中的文件中讀取模式時(shí),高級(jí)文件中的模式(直到工作樹(shù)的頂層)被低層文件中的模式覆蓋到包含文件。這些模式相對(duì)于.gitignore文件的位置相匹配。項(xiàng)目通常.gitignore在其存儲(chǔ)庫(kù)中包含這些文件,其中包含作為項(xiàng)目構(gòu)建的一部分生成的文件的模式。

  • 模式讀取$GIT_DIR/info/exclude。

  • 模式從配置變量指定的文件中讀取core.excludesFile。

放置模式的文件取決于模式的使用方式。

  • 應(yīng)該通過(guò)克隆版本控制并分發(fā)到其他存儲(chǔ)庫(kù)的模式(即,所有開(kāi)發(fā)人員都希望忽略的.gitignore文件)應(yīng)該放入文件中。

  • 特定于特定存儲(chǔ)庫(kù)但不需要與其他相關(guān)存儲(chǔ)庫(kù)共享的模式(例如存儲(chǔ)在存儲(chǔ)庫(kù)內(nèi)但是特定于一個(gè)用戶(hù)工作流的輔助文件)應(yīng)該放入該  $GIT_DIR/info/exclude文件中。

  • 用戶(hù)希望 Git 在所有情況下都忽略的模式(例如,由用戶(hù)選擇的編輯器生成的備份或臨時(shí)文件)通常會(huì)進(jìn)入core.excludesFile用戶(hù)指定的文件~/.gitconfig。它的默認(rèn)值是 $ XDG_CONFIG_HOME / git / ignore。如果 $ XDG_CONFIG_HOME 未設(shè)置或?yàn)榭?,則使用 $ HOME / .config / git / ignore。底層 Git 管道工具(例如git ls-filesgit read-tree)讀取gitignore由命令行選項(xiàng)指定的模式或從命令行指定的文件選項(xiàng)。更高級(jí)的 Git 工具,比如git statusgit add,使用來(lái)自上面指定源的模式。模式格式

  • 空白行不匹配任何文件,因此它可以作為可讀性的分隔符。

  • 以 # 開(kāi)始的行作為評(píng)論。將\第一個(gè)散列前面的反斜杠(“ ”)放在以散列開(kāi)頭的模式中。

  • 尾部空格被忽略,除非用反斜杠(“ \”)引用。

  • 可選的前綴“ !”,否定模式; 任何先前模式排除的匹配文件將再次包含在內(nèi)。如果排除該文件的父目錄,則不可能重新包含文件。由于性能原因,Git 沒(méi)有列出排除的目錄,因此無(wú)論它們被定義在何處,包含文件的任何模式都不起作用。將反斜杠(“ \”)放在第一個(gè)“ !”之前,以“ !” 開(kāi)頭的模式,例如“ \!important!.txt”。

  • 如果模式以斜杠結(jié)尾,則為了以下描述的目的將其刪除,但它只會(huì)與目錄找到匹配項(xiàng)。換句話說(shuō),foo/它將匹配一個(gè)目錄foo和它下面的路徑,但不匹配一個(gè)常規(guī)文件或符號(hào)鏈接foo(這與在Git中通常如何工作的方式一致)。

  • 如果模式不包含斜線/,則Git將其視為 shell glob 模式,并檢查與.gitignore文件位置相關(guān)的路徑名的匹配(相對(duì)于工作樹(shù)的頂層,如果不是來(lái)自.gitignore文件)。

  • 否則,Git 將該模式視為適合 fnmatch(3)使用 FNM_PATHNAME 標(biāo)志使用的 shell glob:模式中的通配符不會(huì)與路徑名中的/匹配。例如,“Documentation / *。html” 與 “Documentation / git.html” 匹配,但不匹配 “Documentation / ppc / ppc.html” 或 “tools / perf / Documentation / perf.html”。

  • 前導(dǎo)斜杠匹配路徑名的開(kāi)頭。例如,“/*.c” 與 “cat-file.c” 匹配,但不匹配 “mozilla-sha1 / sha1.c” **。匹配完整路徑名的模式中的兩個(gè)連續(xù)星號(hào)(“ ”)可能有特殊含義:

  • 前面的“ **”后跟斜杠意味著所有目錄匹配。例如,“ **/foofoo在任何地方與文件或目錄“ ”匹配,與模式“ foo” 相同?!?**/foo/bar”與bar直接在目錄“ foo” 下的任何地方的文件或目錄“ ”匹配。

  • 尾隨 “ /**” 匹配內(nèi)部的所有內(nèi)容。例如,“ abc/**” 匹配目錄 “ abc” 內(nèi)的所有文件,相對(duì)于.gitignore文件的位置,具有無(wú)限深度。

  • 斜杠后跟兩個(gè)連續(xù)的星號(hào),則斜線匹配零個(gè)或多個(gè)目錄。例如,“ a/**/b” 匹配“ a/b”,“ a/x/b”,“ a/x/y/b” 等。

  • 其他連續(xù)的星號(hào)被認(rèn)為是無(wú)效的。

筆記

gitignore 文件的目的是確保未被 Git 跟蹤的某些文件保持未被跟蹤。

要停止跟蹤當(dāng)前跟蹤的文件,請(qǐng)使用git rm --cached。

例子

    $ git status    [...]
    # Untracked files:    [...]
    #       Documentation/foo.html
    #       Documentation/gitignore.html
    #       file.o
    #       lib.a
    #       src/internal.o    [...]
    $ cat .git/info/exclude
    # ignore objects and archives, anywhere in the tree.    *.[oa]
    $ cat Documentation/.gitignore
    # ignore generated html files,    *.html
    # except foo.html which is maintained by hand    !foo.html
    $ git status    [...]
    # Untracked files:    [...]
    #       Documentation/foo.html    [...]

另一個(gè)例子:

    $ cat .gitignore
    vmlinux*
    $ ls arch/foo/kernel/vm*
    arch/foo/kernel/vmlinux.lds.S
    $ echo '!/vmlinux*' >arch/foo/kernel/.gitignore

第二個(gè) .gitignore 防止 Git 忽略arch/foo/kernel/vmlinux.lds.S

示例排除除特定目錄以外的所有內(nèi)容foo/bar(請(qǐng)注意/*- 沒(méi)有斜杠,通配符也會(huì)排除所有內(nèi)容foo/bar):

    $ cat .gitignore
    # exclude everything except directory foo/bar    /*
    !/foo
    /foo/*
    !/foo/bar
Previous article: Next article: