Git commands:

Removing Un-tracked files:

git clean -f

But beware… there’s no going back. Use -n or --dry-run to preview the damage you’ll do.

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.

Note that as of git-1.6.0, the dashed style of writing git commands (ie, git-clean instead of git clean) is obsoleted.

See the git-clean docs for more information.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s