You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/stashing-cleaning.asc
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,20 +225,19 @@ This is a nice shortcut to recover stashed work easily and work on it in a new b
225
225
[[_git_clean]]
226
226
==== Cleaning your Working Directory
227
227
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.
230
229
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.
232
231
233
232
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.
234
233
If you change your mind, there is often no retrieving the content of those files.
235
234
A safer option is to run `git stash --all` to remove everything but save it in a stash.
236
235
237
236
Assuming you do want to remove cruft files or clean your working directory, you can do so with `git clean`.
238
237
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.
240
239
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''.
0 commit comments