1GIT-STRIPSPACE(1)                 Git Manual                 GIT-STRIPSPACE(1)
2
3
4

NAME

6       git-stripspace - Remove unnecessary whitespace
7

SYNOPSIS

9       git stripspace [-s | --strip-comments]
10       git stripspace [-c | --comment-lines]
11

DESCRIPTION

13       Read text, such as commit messages, notes, tags and branch
14       descriptions, from the standard input and clean it in the manner used
15       by Git.
16
17       With no arguments, this will:
18
19       •   remove trailing whitespace from all lines
20
21       •   collapse multiple consecutive empty lines into one empty line
22
23       •   remove empty lines from the beginning and end of the input
24
25       •   add a missing \n to the last line if necessary.
26
27       In the case where the input consists entirely of whitespace characters,
28       no output will be produced.
29
30       NOTE: This is intended for cleaning metadata, prefer the
31       --whitespace=fix mode of git-apply(1) for correcting whitespace of
32       patches or files in the repository.
33

OPTIONS

35       -s, --strip-comments
36           Skip and remove all lines starting with comment character (default
37           #).
38
39       -c, --comment-lines
40           Prepend comment character and blank to each line. Lines will
41           automatically be terminated with a newline. On empty lines, only
42           the comment character will be prepended.
43

EXAMPLES

45       Given the following noisy input with $ indicating the end of a line:
46
47           |A brief introduction   $
48           |   $
49           |$
50           |A new paragraph$
51           |# with a commented-out line    $
52           |explaining lots of stuff.$
53           |$
54           |# An old paragraph, also commented-out. $
55           |      $
56           |The end.$
57           |  $
58
59       Use git stripspace with no arguments to obtain:
60
61           |A brief introduction$
62           |$
63           |A new paragraph$
64           |# with a commented-out line$
65           |explaining lots of stuff.$
66           |$
67           |# An old paragraph, also commented-out.$
68           |$
69           |The end.$
70
71       Use git stripspace --strip-comments to obtain:
72
73           |A brief introduction$
74           |$
75           |A new paragraph$
76           |explaining lots of stuff.$
77           |$
78           |The end.$
79

GIT

81       Part of the git(1) suite
82
83
84
85Git 2.31.1                        2021-03-26                 GIT-STRIPSPACE(1)
Impressum