有時做Build會引入很多之前沒加入.gitignore的檔案。這時你不可能每個目錄每個檔案地去刪。
你要做的,git都幫你做好了。
hyang0@positive$ git --version
git version 1.7.4.1
git clean -df
可幫你搞定一切。
舉例:
git clean -dn 這個命令可以看看有哪此檔案和目錄會被刪
git clean -f 只會刪檔案,不會刪目錄
hyang0@positive$
git status
# On branch master
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: .gitignore
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# COPYING
# INSTALL
# Makefile.in
# aclocal.m4
# autom4te.cache/
# config.h.in
# configure
# depcomp
# install-sh
# missing
no changes added to commit (use "git add" and/or "git commit -a")
hyang0@positive$ git clean -dn
Would remove COPYING
Would remove INSTALL
Would remove Makefile.in
Would remove aclocal.m4
Would remove autom4te.cache/
Would remove config.h.in
Would remove configure
Would remove depcomp
Would remove install-sh
Would remove missing
hyang0@positive$ git clean -df
Removing COPYING
Removing INSTALL
Removing Makefile.in
Removing aclocal.m4
Removing autom4te.cache/
Removing config.h.in
Removing configure
Removing depcomp
Removing install-sh
Removing missing
hyang0@positive$ git status
# On branch master
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: .gitignore
#
no changes added to commit (use "git add" and/or "git commit -a")
網址:http://hi.baidu.com/d_life/blog/item/c5ef6e82b3c424a76c811983.html