1GIT-STRIPSPACE(1) Git Manual GIT-STRIPSPACE(1)
2
3
4
6 git-stripspace - Remove unnecessary whitespace
7
9 git stripspace [-s | --strip-comments]
10 git stripspace [-c | --comment-lines]
11
12
14 Read text, such as commit messages, notes, tags and branch
15 descriptions, from the standard input and clean it in the manner used
16 by Git.
17
18 With no arguments, this will:
19
20 · remove trailing whitespace from all lines
21
22 · collapse multiple consecutive empty lines into one empty line
23
24 · remove empty lines from the beginning and end of the input
25
26 · add a missing \n to the last line if necessary.
27
28 In the case where the input consists entirely of whitespace characters,
29 no output will be produced.
30
31 NOTE: This is intended for cleaning metadata, prefer the
32 --whitespace=fix mode of git-apply(1) for correcting whitespace of
33 patches or files in the repository.
34
36 -s, --strip-comments
37 Skip and remove all lines starting with comment character (default
38 #).
39
40 -c, --comment-lines
41 Prepend comment character and blank to each line. Lines will
42 automatically be terminated with a newline. On empty lines, only
43 the comment character will be prepended.
44
46 Given the following noisy input with $ indicating the end of a line:
47
48 |A brief introduction $
49 | $
50 |$
51 |A new paragraph$
52 |# with a commented-out line $
53 |explaining lots of stuff.$
54 |$
55 |# An old paragraph, also commented-out. $
56 | $
57 |The end.$
58 | $
59
60
61 Use git stripspace with no arguments to obtain:
62
63 |A brief introduction$
64 |$
65 |A new paragraph$
66 |# with a commented-out line$
67 |explaining lots of stuff.$
68 |$
69 |# An old paragraph, also commented-out.$
70 |$
71 |The end.$
72
73
74 Use git stripspace --strip-comments to obtain:
75
76 |A brief introduction$
77 |$
78 |A new paragraph$
79 |explaining lots of stuff.$
80 |$
81 |The end.$
82
83
85 Part of the git(1) suite
86
87
88
89Git 2.21.0 02/24/2019 GIT-STRIPSPACE(1)