git之.gitignore文件用途

gitignore文件用於忽略無需追蹤的文件。html

配置文件:git

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

舉例說明:it

$ 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]
$ git status
# Untracked files:
    [...]
    #       Documentation/foo.html
    #       Documentation/gitignore.html

$ cat .gitignore
# ignore generated html files,
*.html
# except foo.html which is maintained by hand
!foo.html
$ git status
[...]
# Untracked files:
[...]
#       Documentation/foo.html
[...]
相關文章
相關標籤/搜索