Make sure all changes are commited including the .gitignore
To clear the repo, use: git rm -r --cached .
rm
is the remove command-r
will allow recursive removal--cached
will remove files from the index. (Your file will still be there).
indicates that all files will be untracked.- Untracking a specific file use:
git rm --cached foo.txt
- Untracking a specific file use:
The
rm
command can be unforgiving. If you wish to try what it does beforehand, add the-n
or--dry-run
flag to test.
git add .
git commit -m '.gitignore fix'
source: http://www.codeblocq.com/2016/01/Untrack-files-already-added-to-git-repository-based-on-gitignore/