Skip to content

Instantly share code, notes, and snippets.

@j796160836
Created August 31, 2016 10:41
Show Gist options
  • Save j796160836/eca9c3553769549be942858cbdcfc847 to your computer and use it in GitHub Desktop.
Save j796160836/eca9c3553769549be942858cbdcfc847 to your computer and use it in GitHub Desktop.
Strip out files defined in .gitignore on git repo
#!/bin/bash
# Referance: http://stackoverflow.com/questions/13541615/how-to-remove-files-that-are-listed-in-the-gitignore-but-still-on-the-repositor
git ls-files -i --exclude-from=.gitignore | xargs git rm --cached
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment