2016-11-18 15:31:10 +00:00
|
|
|
# git clean
|
|
|
|
|
|
|
|
> Remove untracked files 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
|
|
|
|
2021-01-07 14:06:38 +00:00
|
|
|
- Delete files that are not tracked by Git:
|
2016-11-18 15:31:10 +00:00
|
|
|
|
|
|
|
`git clean`
|
|
|
|
|
2021-01-07 14:06:38 +00:00
|
|
|
- Interactively delete files that are not tracked by Git:
|
2016-11-18 15:31:10 +00:00
|
|
|
|
|
|
|
`git clean -i`
|
|
|
|
|
2017-04-17 17:54:29 +01:00
|
|
|
- Show what 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
|
|
|
|
2021-01-07 14:06:38 +00:00
|
|
|
- Forcefully delete files that are not tracked by Git:
|
2016-12-23 09:30:14 +00:00
|
|
|
|
|
|
|
`git clean -f`
|
|
|
|
|
2021-01-07 14:06:38 +00:00
|
|
|
- Forcefully delete directories that are not tracked by Git:
|
2018-07-05 20:16:35 +01:00
|
|
|
|
|
|
|
`git clean -fd`
|
|
|
|
|
2017-02-04 10:37:09 +00:00
|
|
|
- Delete untracked files, including ignored files in `.gitignore` and `.git/info/exclude`:
|
2016-12-23 09:30:14 +00:00
|
|
|
|
|
|
|
`git clean -x`
|