2 .\" Title: git-stripspace
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
7 .\" Source: Git 2.47.0.rc0
10 .TH "GIT\-STRIPSPACE" "1" "2024-09-25" "Git 2\&.47\&.0\&.rc0" "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]
40 Read text, such as commit messages, notes, tags and branch descriptions, from the standard input and clean it in the manner used by Git\&.
42 With no arguments, this will:
52 remove trailing whitespace from all lines
63 collapse multiple consecutive empty lines into one empty line
74 remove empty lines from the beginning and end of the input
87 to the last line if necessary\&.
90 In the case where the input consists entirely of whitespace characters, no output will be produced\&.
92 \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\&.
95 \-s, \-\-strip\-comments
97 Skip and remove all lines starting with a comment character (default
101 \-c, \-\-comment\-lines
103 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\&.
107 Given the following noisy input with \fI$\fR indicating the end of a line:
113 |A brief introduction $
117 |# with a commented\-out line $
118 |explaining lots of stuff\&.$
120 |# An old paragraph, also commented\-out\&. $
129 Use \fIgit stripspace\fR with no arguments to obtain:
135 |A brief introduction$
138 |# with a commented\-out line$
139 |explaining lots of stuff\&.$
141 |# An old paragraph, also commented\-out\&.$
149 Use \fIgit stripspace \-\-strip\-comments\fR to obtain:
155 |A brief introduction$
158 |explaining lots of stuff\&.$
167 Part of the \fBgit\fR(1) suite