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
@@ -226,20 +226,19 @@ This is a nice shortcut to recover stashed work easily and work on it in a new b
226
226
[[_git_clean]]
227
227
==== Cleaning your Working Directory
228
228
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.
231
230
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.
233
232
234
233
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.
235
234
If you change your mind, there is often no retrieving the content of those files.
236
235
A safer option is to run `git stash --all` to remove everything but save it in a stash.
237
236
238
237
Assuming you do want to remove cruft files or clean your working directory, you can do so with `git clean`.
239
238
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.
241
240
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''.
0 commit comments