Skip to content

Instantly share code, notes, and snippets.

@imghasemi
Last active July 30, 2019 13:40
Show Gist options
  • Save imghasemi/a0ad7e09047054b41d4f3ebe48389ed0 to your computer and use it in GitHub Desktop.
Save imghasemi/a0ad7e09047054b41d4f3ebe48389ed0 to your computer and use it in GitHub Desktop.
Remove a file from a Git repository without deleting it from the local filesystem
# good solution described here: https://stackoverflow.com/a/21477287
# This command removes files from the repository based on your .gitignore without deleting them from the local file system :
git rm --cached `git ls-files -i -X .gitignore`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment