Skip to content

Commit 2ff6cea

Browse files
committed
cleaning: minor rewording, mention "clean.requireForce" config var
Signed-off-by: Robert P. J. Day <[email protected]>
1 parent 7a13f5a commit 2ff6cea

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

book/07-git-tools/sections/stashing-cleaning.asc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,19 @@ This is a nice shortcut to recover stashed work easily and work on it in a new b
225225
[[_git_clean]]
226226
==== Cleaning your Working Directory
227227

228-
Finally, you may not want to stash some work or files in your working directory, but simply get rid of them.
229-
The `git clean` command will do this for you.
228+
Finally, you may not want to stash some work or files in your working directory, but simply get rid of them; that's what the `git clean` command is for.
230229

231-
Some common reasons for this might be to remove cruft that has been generated by merges or external tools or to remove build artifacts in order to run a clean build.
230+
Some common reasons for cleaning your working directory might be to remove cruft that has been generated by merges or external tools or to remove build artifacts in order to run a clean build.
232231

233232
You'll want to be pretty careful with this command, since it's designed to remove files from your working directory that are not tracked.
234233
If you change your mind, there is often no retrieving the content of those files.
235234
A safer option is to run `git stash --all` to remove everything but save it in a stash.
236235

237236
Assuming you do want to remove cruft files or clean your working directory, you can do so with `git clean`.
238237
To remove all the untracked files in your working directory, you can run `git clean -f -d`, which removes any files and also any subdirectories that become empty as a result.
239-
The `-f` means 'force' or "really do this".
238+
The `-f` means 'force' or ``really do this,'' and is required if the Git configuration variable `clean.requireForce` is not explicitly set to false.
240239

241-
If you ever want to see what it would do, you can run the command with the `-n` option, which means ``do a dry run and tell me what you _would_ have removed''.
240+
If you ever want to see what it would do, you can run the command with the `--dry-run` (or `-n`) option, which means ``do a dry run and tell me what you _would_ have removed''.
242241

243242
[source,console]
244243
----

0 commit comments

Comments
 (0)