remove all track file which are ignored in the .gitignore - 把git裡面屬於.gitignore檔案被加入版控的檔案從版控刪掉 #git
Sometimes some files are accedntily added into the source control, which later relaized caused by not include a project level .gitignore
Below command provide way to remove all track files which should be ignored
Produce the .gitignore
file first and place in the root of git project
Remove all files (-r
for recurse, .
mean from current directory) from git
but leave the physical file untouch (indicate by the --cache
option)
git rm -r --cached .
git add .
git commit -m "Add gitignore and remove ignore track file"