Skip to content

Commit c0be6b4

Browse files
jiangxingitster
authored andcommitted
git-clean: add documentation for interactive git-clean
Add new section "Interactive mode" for documentation of interactive git-clean. Signed-off-by: Jiang Xin <[email protected]> Helped-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 96a799b commit c0be6b4

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

Documentation/git-clean.txt

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ OPTIONS
3939

4040
-i::
4141
--interactive::
42-
Show what would be done and the user must confirm before actually
43-
cleaning.
42+
Show what would be done and clean files interactively. See
43+
``Interactive mode'' for details.
4444

4545
-n::
4646
--dry-run::
@@ -69,6 +69,67 @@ OPTIONS
6969
Remove only files ignored by Git. This may be useful to rebuild
7070
everything from scratch, but keep manually created files.
7171

72+
Interactive mode
73+
----------------
74+
When the command enters the interactive mode, it shows the
75+
files and directories to be cleaned, and goes into its
76+
interactive command loop.
77+
78+
The command loop shows the list of subcommands available, and
79+
gives a prompt "What now> ". In general, when the prompt ends
80+
with a single '>', you can pick only one of the choices given
81+
and type return, like this:
82+
83+
------------
84+
*** Commands ***
85+
1: clean 2: filter by pattern 3: select by numbers
86+
4: ask each 5: quit 6: help
87+
What now> 1
88+
------------
89+
90+
You also could say `c` or `clean` above as long as the choice is unique.
91+
92+
The main command loop has 6 subcommands.
93+
94+
clean::
95+
96+
Start cleaning files and directories, and then quit.
97+
98+
filter by pattern::
99+
100+
This shows the files and directories to be deleted and issues an
101+
"Input ignore patterns>>" prompt. You can input space-seperated
102+
patterns to exclude files and directories from deletion.
103+
E.g. "*.c *.h" will excludes files end with ".c" and ".h" from
104+
deletion. When you are satisfied with the filtered result, press
105+
ENTER (empty) back to the main menu.
106+
107+
select by numbers::
108+
109+
This shows the files and directories to be deleted and issues an
110+
"Select items to delete>>" prompt. When the prompt ends with double
111+
'>>' like this, you can make more than one selection, concatenated
112+
with whitespace or comma. Also you can say ranges. E.g. "2-5 7,9"
113+
to choose 2,3,4,5,7,9 from the list. If the second number in a
114+
range is omitted, all remaining patches are taken. E.g. "7-" to
115+
choose 7,8,9 from the list. You can say '*' to choose everything.
116+
Also when you are satisfied with the filtered result, press ENTER
117+
(empty) back to the main menu.
118+
119+
ask each::
120+
121+
This will start to clean, and you must confirm one by one in order
122+
to delete items. Please note that this action is not as efficient
123+
as the above two actions.
124+
125+
quit::
126+
127+
This lets you quit without do cleaning.
128+
129+
help::
130+
131+
Show brief usage of interactive git-clean.
132+
72133
SEE ALSO
73134
--------
74135
linkgit:gitignore[5]

0 commit comments

Comments
 (0)