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