6 git-stripspace - Remove unnecessary whitespace
12 'git stripspace' [-s | --strip-comments] < input
17 Clean the input in the manner used by Git for text such as commit
18 messages, notes, tags and branch descriptions.
20 With no arguments, this will:
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.
27 In the case where the input consists entirely of whitespace characters, no
28 output will be produced.
30 *NOTE*: This is intended for cleaning metadata, prefer the `--whitespace=fix`
31 mode of linkgit:git-apply[1] for correcting whitespace of patches or files in
38 Skip and remove all lines starting with '#'.
43 Given the following noisy input with '$' indicating the end of a line:
46 |A brief introduction $
50 |# with a commented-out line $
51 |explaining lots of stuff.$
53 |# An old paragraph, also commented-out. $
59 Use 'git stripspace' with no arguments to obtain:
62 |A brief introduction$
65 |# with a commented-out line$
66 |explaining lots of stuff.$
68 |# An old paragraph, also commented-out.$
73 Use 'git stripspace --strip-comments' to obtain:
76 |A brief introduction$
79 |explaining lots of stuff.$
86 Part of the linkgit:git[1] suite