Redis allows you to list keys by giving a pattern and returning all the keys that match that pattern (KEYS ts* for example, lists all keys that start with “ts”).  You can delete all the keys by using FLUSHALL and you can delete one by using DEL, but you can’t natively delete a set of keys by giving the pattern using redis-cli alone.

But with linux (or if you have the git extensions folder in your path on Windows), you can do this:

redis-cli -h REDIS_URL KEYS “ts*” | xargs redis-cli -h REDIS_URL DEL

which deletes all the keys that start with “ts” in the redis instance pointed to by REDIS_URL.

If you are a scrub like me, you checked in your code to git before you added a .gitignore and now your git repo is full of things you don’t want.  This is especially important when you are working with a compiled language like C#.

Here’s how to delete all the files from your repo that would have been ignored by your .gitignore:

git ls-files -i --exclude-from=.gitignore | xargs git rm --cached