2 .\" Title: git-stripspace
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.44.0.568.g436d4e5b14
10 .TH "GIT\-STRIPSPACE" "1" "2024\-04\-10" "Git 2\&.44\&.0\&.568\&.g436d4e" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-stripspace \- Remove unnecessary whitespace
35 \fIgit stripspace\fR [\-s | \-\-strip\-comments]
36 \fIgit stripspace\fR [\-c | \-\-comment\-lines]
41 Read text, such as commit messages, notes, tags and branch descriptions, from the standard input and clean it in the manner used by Git\&.
43 With no arguments, this will:
53 remove trailing whitespace from all lines
64 collapse multiple consecutive empty lines into one empty line
75 remove empty lines from the beginning and end of the input
88 to the last line if necessary\&.
91 In the case where the input consists entirely of whitespace characters, no output will be produced\&.
93 \fBNOTE\fR: This is intended for cleaning metadata\&. Prefer the \fB\-\-whitespace=fix\fR mode of \fBgit-apply\fR(1) for correcting whitespace of patches or files in the repository\&.
96 \-s, \-\-strip\-comments
98 Skip and remove all lines starting with a comment character (default
102 \-c, \-\-comment\-lines
104 Prepend the comment character and a blank space to each line\&. Lines will automatically be terminated with a newline\&. On empty lines, only the comment character will be prepended\&.
108 Given the following noisy input with \fI$\fR indicating the end of a line:
114 |A brief introduction $
118 |# with a commented\-out line $
119 |explaining lots of stuff\&.$
121 |# An old paragraph, also commented\-out\&. $
131 Use \fIgit stripspace\fR with no arguments to obtain:
137 |A brief introduction$
140 |# with a commented\-out line$
141 |explaining lots of stuff\&.$
143 |# An old paragraph, also commented\-out\&.$
152 Use \fIgit stripspace \-\-strip\-comments\fR to obtain:
158 |A brief introduction$
161 |explaining lots of stuff\&.$
171 Part of the \fBgit\fR(1) suite