Starkers
Starkers

Reputation: 10531

Remove ignored files from git repository

Here's my gitignore:

/.bundle

*.pid
*.sock
dump.rdb
Gemfile.lock

db/*.sqlite3
log/*.log
tmp/**/*
private/**
tmp/cache/**

*.zip
*.log

.DS_Store
.DS_Store?

And yet I just run git status

and:

#   modified:   tmp/cache/assets/development/sprockets/<hash>
#   modified:   tmp/cache/assets/development/sprockets/<hash>
#   modified:   tmp/cache/assets/development/sprockets/<hash>
#   modified:   tmp/cache/assets/development/sprockets/<hash>
#   modified:   tmp/cache/assets/development/sprockets/<hash>
#   modified:   tmp/cache/assets/development/sprockets/<hash>

And yet I'm ignoring tmp/**/* and even tmp/cache/**

I've run git rm --cached tmp/cache/assets/development/sprockets/<hash> for all of them about a million times and they still pop in. Why is this?

Upvotes: 2

Views: 1009

Answers (1)

Joey
Joey

Reputation: 350

Im not sure how your environment is setup but on mine I had a similar issue and I had to remove the cached on both my production and my dev environment. I suggest you try this command instead of the rm --cached this will update the index and state that the file will presumable be unchanged so dont update it in the repo, this is especially helpful when multiple people are working on the same repo/files.

git update-index --assume-unchanged /path/to/file

You can also try untracking the whole cache directory with:

git rm -r --cached /tmp/cache/

Hopefully this helps!

Upvotes: 2

Related Questions