Skip to content

Instantly share code, notes, and snippets.

@JoshuaEstes
Last active October 6, 2015 06:58
Show Gist options
  • Save JoshuaEstes/2954584 to your computer and use it in GitHub Desktop.
Save JoshuaEstes/2954584 to your computer and use it in GitHub Desktop.
Oneline to delete all files that are not tracked in t git repository. Use grep if you only want certain files
Bash oneliner
for file in $(git ls-files --other --exclude-standard); do rm "$file"; done
Git Clean, does the exact same thing
git clean -df
@noirsoldats
Copy link

check out git clean

@JoshuaEstes
Copy link
Author

git clean -nd
git clean -df

-n is dry run, -d is to remove directories, -f- will remove the file files/folders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment