BluePython
BluePython

Reputation: 1597

Why is git still tracking files with extensions already added to .gitignore file

I am having problems with data.sqlite and members/model.pyc This is how my .gitignore file looks. If the above-mentioned files show as modified it means git is still tracking them right? These files were not tracked before so I am not sure why it is not ignoring those files....

*.py[cod]
*.sqlite
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
*.log
*.pot
*.pyc
local_settings.py

Upvotes: 4

Views: 2694

Answers (3)

AMakerMark
AMakerMark

Reputation: 11

If you would like git to ignore changes to a file in the repo you can use:

git update-index --assume-unchanged foo.pyc

This will keep the file in the working directory as well as the repository itself.

Note that using git rm --cached foo.pyc will keep the file in the working directory but will stage the file to be deleted from the repo.

Upvotes: 1

kuba_ceg
kuba_ceg

Reputation: 930

try remove those files from git cache

git rm --cached data.sqlite
git rm --cached members/model.pyc

Upvotes: 0

nanofarad
nanofarad

Reputation: 41281

If the file already exists, you need to force-delete it:

git rm --cached foo.pyc

for every file already tracked. Commit, push, and profit. The file will remain ignored but in the working directory.

Upvotes: 9

Related Questions