tips
- exclude everything except directory foo/bar
/*
!/foo
/foo/*
!/foo/bar
- Show ignored files in git cache by .gitignore
git ls-files -i --exclude-from=/.gitignore
- ignore and remove file in git only (use --cached)
echo -e \!file >> /.gitignore
git ls-files -i --exclude-from=/.gitignore | xargs git rm -r --cached