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