EN
Git - remove untracked files
6 points
In this short article we would like to show how to remove untracked files using Git in command line.
Run following command:
xxxxxxxxxx
1
git clean -fd
Where -fd
means: clean files and directories.
Let's suppose we want to remove logs
directory.
Simple steps:
- check if some files are untracked
xxxxxxxxxx
1git status
Output:
xxxxxxxxxx
1On branch master
2Your branch is up to date with 'origin/master'.
3
4Untracked files:
5(use "git add <file>..." to include in what will be committed)
6
7logs/
8
9nothing added to commit but untracked files present (use "git add" to track)
- clean untracked files
xxxxxxxxxx
1git clean -fd
Output:
xxxxxxxxxx
1Removing logs/
- check if files were removed:
xxxxxxxxxx
1git status
Output:
xxxxxxxxxx
1On branch master
2Your branch is up to date with 'origin/master'.
3
4nothing to commit, working tree clean