Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing non-repository files with git?

Tags:

git

People also ask

How do I remove a file from git?

The easiest way to delete a file in your Git repository is to execute the “git rm” command and to specify the file to be deleted. Note that by using the “git rm” command, the file will also be deleted from the filesystem.


You can use git-clean. This command will remove untracked files/directories. By default, it will only print what it would have removed, without actually removing them.

Given the -f flag to remove the files, and the -d flag to remove empty directories as well :

git clean -df

Also removing ignored files :

git clean -dfx