Skip to content

Instantly share code, notes, and snippets.

@skounis
Created March 14, 2022 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skounis/d9348b722e0f56cfe852fbe3adca4f98 to your computer and use it in GitHub Desktop.
Save skounis/d9348b722e0f56cfe852fbe3adca4f98 to your computer and use it in GitHub Desktop.
Git ignore and remove files from the history (cached)
# List all the ignored files previously commited
git ls-files -ci --exclude-standard
# Remove file from Git's history. It keeps it in the file system
git rm --cached path/to/file
# Remove all the ignored files
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment