Here is the situation I'm facing:

A directory full of generated files where commited to the repo by mistake. They obviously shouldn't have been, so I want to remove them:

```
$ git rm --cached foo/*
$ cat > foo/.gitignore
*
!.gitignore
$ git add foo/
$ git commit -m "Ignored stuff in foo"

```

This almost solves it, but leaves a different problem. When I want to `git fetch && git checkout` on the production server, all the generated files in the foo/ directory will be removed. Is there some magic I could do about it on either side? Please not that simply ignoring them is not an option as they can be changed.