Following the Github guide on removing sensitive data seems to result in the offending file being completely removed, including from the directory. Is there a way to remove the offending file from only the git repository (as if it had never been committed), but not remove it from the directory? Obviously it should then be added to the .gitignore file.
Note: this is only a hypothetical question; I haven't actually exposed sensitive information.
Edit: I do realize I could simply copy the file out of the directory, then move it back after following the instructions on Github. I'd like to know if there's a "git way" to accomplish what I'm asking.