2016-11-18 15:31:10 +00:00
|
|
|
# git clean
|
|
|
|
|
2024-02-24 14:35:56 +00:00
|
|
|
> Remove files not tracked by Git from the working tree.
|
2019-06-03 01:06:36 +01:00
|
|
|
> More information: <https://git-scm.com/docs/git-clean>.
|
2016-11-18 15:31:10 +00:00
|
|
|
|
2024-02-24 14:35:56 +00:00
|
|
|
- Delete untracked files:
|
2016-11-18 15:31:10 +00:00
|
|
|
|
|
|
|
`git clean`
|
|
|
|
|
2024-02-24 14:35:56 +00:00
|
|
|
- [i]nteractively delete untracked files:
|
2016-11-18 15:31:10 +00:00
|
|
|
|
2024-08-31 12:06:48 +01:00
|
|
|
`git clean {{--interactive|-i}}`
|
2016-11-18 15:31:10 +00:00
|
|
|
|
2024-02-24 14:35:56 +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
|
|
|
|
2024-08-31 12:06:48 +01:00
|
|
|
- Forcefully delete untracked files:
|
2016-12-23 09:30:14 +00:00
|
|
|
|
2024-08-31 12:06:48 +01:00
|
|
|
`git clean {{--force|-f}}`
|
2016-12-23 09:30:14 +00:00
|
|
|
|
2024-08-31 12:06:48 +01:00
|
|
|
- Forcefully delete untracked [d]irectories:
|
2018-07-05 20:16:35 +01:00
|
|
|
|
2024-08-31 12:06:48 +01:00
|
|
|
`git clean {{--force|-f}} -d`
|
2018-07-05 20:16:35 +01:00
|
|
|
|
2024-02-24 14:35:56 +00: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`
|