这个方法非常管用哟
方法一: 适用于全局情况
bash
git rm -r --cached .
bash
git add .
bash
git commit -m "apply .gitignore and remove ignored files"
bash
git push
方法二: 适用于局部情况
bash
git rm -r --cached some_dir
bash
git rm --cached some_file
bash
git commit -m "stop tracking ignored files"
bash
git push