Automatically remove untracked files in git

Use git clean.

-f : force. if clean.requireForce is true, nothing will actually happen (in recent-enough versions of git)

-d : remove directories too

-X : remove ignored files (according to .gitignore) (note uppercase X)

-x : remove ignored and non-ignored files (note lowercase x)

via StackOverflow

Leave a Reply