git 添加忽略列表

用Eclipse PDT开发PHP时,Eclipse会自动创建几个系统文件。这些文件在Git提交时可以忽略。

 

使用git status可以看到这些文件(.project, .buildpath和.settings):

复制代码
$ git status
# On branch master
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#    .buildpath
#    .project
#    .settings/
#    includes/
#    index.php
nothing added to commit but untracked files present (use "git add" to track)
复制代码

 

怎么忽略呢?方法是创建.gitignore文件,将需要略过的文件名和目录名添加到.gitignore:

$ cat .gitignore 
.project
.buildpath
.settings

 

再用git status查看,就看不到这几个文件了:

复制代码
$ git status
# On branch master
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#    .gitignore
#    includes/
#    index.php
nothing added to commit but untracked files present (use "git add" to track)
复制代码

你可能感兴趣的:(ubuntu,git)