How do you remove untracked files from your git working copy?
Is it possible to tell git to remove untrack files? Mainly something that is similar to a reset?
git checkout -- index.php <-- revert my file git checkout -- master <-- this would revert the entire repo back to the last commit on master, removing (deleting) any and all untracked files as well as reverting committed ones.
I know this is trivial todo on the shell, but I'd like to know if this can be done in Git?
git checkout -- master will not check out branch master, but will check out the file called master at the current commit (HEAD)
Sorry this is a duplicate.
I have to use -f instead. -x seems to not work for me, got this error: fatal: clean.requireForce defaults to true and neither -i, -n nor -f given; refusing to clean
Hlung: It looks like the default for your Git installation is to require -f. So you would use git clean -f -x.
upvote indeed. git-scm.com/docs/git-clean
This is the ultimate answer to the question. Accepted answer clears the inside of an untracked directory but leaves the directory's itself.