Skip to content

Instantly share code, notes, and snippets.

@sffej
Forked from markSci5/git-clean
Created June 8, 2016 01:34
Show Gist options
  • Save sffej/501f9eaa33920b970b1cdf92e0a70c51 to your computer and use it in GitHub Desktop.
Save sffej/501f9eaa33920b970b1cdf92e0a70c51 to your computer and use it in GitHub Desktop.
Delete all untracked files and folders in git
git clean -f
If you want to also remove directories, run git clean -f -d.
If you just want to remove ignored files, run git clean -f -X.
If you want to remove ignored as well as non-ignored files, run git clean -f -x.
Note the case difference on the X for the two latter commands.
If clean.requireForce is set to "true" (the default) in your configuration, then unless you specify -f nothing will actually happen, with a recent enough version of git.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment