summaryrefslogtreecommitdiffstats
path: root/man1/git-stripspace.1
blob: 0f3ee31bd94615ff2bb01db90d7cbd3d85dd23bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
'\" t
.\"     Title: git-stripspace
.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 2024-04-16
.\"    Manual: Git Manual
.\"    Source: Git 2.44.0.651.g21306a098c
.\"  Language: English
.\"
.TH "GIT\-STRIPSPACE" "1" "2024\-04\-16" "Git 2\&.44\&.0\&.651\&.g21306a" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-stripspace \- Remove unnecessary whitespace
.SH "SYNOPSIS"
.sp
.nf
\fIgit stripspace\fR [\-s | \-\-strip\-comments]
\fIgit stripspace\fR [\-c | \-\-comment\-lines]
.fi
.sp
.SH "DESCRIPTION"
.sp
Read text, such as commit messages, notes, tags and branch descriptions, from the standard input and clean it in the manner used by Git\&.
.sp
With no arguments, this will:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
remove trailing whitespace from all lines
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
collapse multiple consecutive empty lines into one empty line
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
remove empty lines from the beginning and end of the input
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
add a missing
\fI\en\fR
to the last line if necessary\&.
.RE
.sp
In the case where the input consists entirely of whitespace characters, no output will be produced\&.
.sp
\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\&.
.SH "OPTIONS"
.PP
\-s, \-\-strip\-comments
.RS 4
Skip and remove all lines starting with a comment character (default
\fI#\fR)\&.
.RE
.PP
\-c, \-\-comment\-lines
.RS 4
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\&.
.RE
.SH "EXAMPLES"
.sp
Given the following noisy input with \fI$\fR indicating the end of a line:
.sp
.if n \{\
.RS 4
.\}
.nf
|A brief introduction   $
|   $
|$
|A new paragraph$
|# with a commented\-out line    $
|explaining lots of stuff\&.$
|$
|# An old paragraph, also commented\-out\&. $
|      $
|The end\&.$
|  $
.fi
.if n \{\
.RE
.\}
.sp
.sp
Use \fIgit stripspace\fR with no arguments to obtain:
.sp
.if n \{\
.RS 4
.\}
.nf
|A brief introduction$
|$
|A new paragraph$
|# with a commented\-out line$
|explaining lots of stuff\&.$
|$
|# An old paragraph, also commented\-out\&.$
|$
|The end\&.$
.fi
.if n \{\
.RE
.\}
.sp
.sp
Use \fIgit stripspace \-\-strip\-comments\fR to obtain:
.sp
.if n \{\
.RS 4
.\}
.nf
|A brief introduction$
|$
|A new paragraph$
|explaining lots of stuff\&.$
|$
|The end\&.$
.fi
.if n \{\
.RE
.\}
.sp
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite