2.1. Gitignore - shinokada/gitnotes GitHub Wiki
Remove the files which you don't want.
# you did git init, added remote, added README file, add and commit then pushed before making .gitignore
# then you realized that you have unnessary file like README.md.swp
# check what you have in the index
$ git ls-files
$ git rm README.md
$ vim .gitignore # add contents in it and close
# OR use .gitignore_global
$ git config --global core.excludesfile ~/.gitignore_global
$ git rm -r --cached .
$ git add .
$ git commit -m "fixed untracked files"
// list gitignore
$ git status --ignored
$ git check-ignore -v *
$ git check-ignore *
$ git clean -ndX
How to exclude folder but include specific subfolder
# you can skip this first one if it is not already excluded by prior patterns
!application/
application/*
!application/language/
application/language/*
!application/language/gr/
To display ignored files.
git check-ignore *
git check-ignore -v *
git clean -ndX
git status --ignored -s
To see which gitignore is ignoring a file
git check-ignore -v -- ../storage/app/mydir/myfile.json
If gitignore is not working.
git rm -r --cached .
git add .
git commit -m "fixing .gitignore"