Reference
Remove sensitive files from Git/Github
In Terminal
git filter-branch --index-filter 'git rm --cached --ignore-unmatch [file path/name]' --prune-empty --tag-name-filter cat -- --all
Example:
git filter-branch --index-filter 'git rm --cached --ignore-unmatch config/database.yml' --prune-empty --tag-name-filter cat -- --all
Add file to .gitignore
echo "[filename]" >> .gitignore
git add .gitignore
git commit -m "Add [filename] to .gitignore"
Example:
echo "Rakefile" >> .gitignore
git add .gitignore
git commit -m "Add Rakefile to .gitignore"
Push the changes to origin repo:
git push origin master --force
Oh man the settings file is entirely gone from all branches now.
One should copy the file before permanently deleting it.
But thanks!