tldr/pages/common/git-clean.md

29 lines
607 B
Markdown
Raw Normal View History

2016-11-18 15:31:10 +00:00
# git clean
> Remove files not tracked by Git from the working tree.
> More information: <https://git-scm.com/docs/git-clean>.
2016-11-18 15:31:10 +00:00
- Delete untracked files:
2016-11-18 15:31:10 +00:00
`git clean`
- [i]nteractively delete untracked files:
2016-11-18 15:31:10 +00:00
`git clean {{--interactive|-i}}`
2016-11-18 15:31:10 +00:00
- Show which files would be deleted without actually deleting them:
2016-11-18 15:31:10 +00:00
`git clean --dry-run`
2016-12-23 09:30:14 +00:00
- Forcefully delete untracked files:
2016-12-23 09:30:14 +00:00
`git clean {{--force|-f}}`
2016-12-23 09:30:14 +00:00
- Forcefully delete untracked [d]irectories:
2018-07-05 20:16:35 +01:00
`git clean {{--force|-f}} -d`
2018-07-05 20:16:35 +01:00
- Delete untracked files, including e[x]cluded files (files ignored in `.gitignore` and `.git/info/exclude`):
2016-12-23 09:30:14 +00:00
`git clean -x`