Skip to content

Commit 6544d71

Browse files
authored
Merge pull request #1148 from rpjday/topic/rpjday/cleaning
cleaning: minor rewording, mention "clean.requireForce" config var
2 parents e0182ff + 2ff6cea commit 6544d71

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
@@ -226,20 +226,19 @@ This is a nice shortcut to recover stashed work easily and work on it in a new b
226226
[[_git_clean]]
227227
==== Cleaning your Working Directory
228228

229-
Finally, you may not want to stash some work or files in your working directory, but simply get rid of them.
230-
The `git clean` command will do this for you.
229+
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.
231230

232-
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.
231+
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.
233232

234233
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.
235234
If you change your mind, there is often no retrieving the content of those files.
236235
A safer option is to run `git stash --all` to remove everything but save it in a stash.
237236

238237
Assuming you do want to remove cruft files or clean your working directory, you can do so with `git clean`.
239238
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.
240-
The `-f` means 'force' or "really do this".
239+
The `-f` means 'force' or ``really do this,'' and is required if the Git configuration variable `clean.requireForce` is not explicitly set to false.
241240

242-
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''.
241+
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''.
243242

244243
[source,console]
245244
----

0 commit comments

Comments
 (0)