git之.gitignore文件用途

gitignore文件用于忽略无需追踪的文件。

配置文件:

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

举例说明:

$ 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
[...]



 

 

posted on 2017-01-05 11:22  小生有悔  阅读(248)  评论(0编辑  收藏  举报

导航