Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 1 | git-stripspace(1) |
| 2 | ================= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Conrad Irwin | 497215d | 2011-12-12 15:52:51 -0800 | [diff] [blame] | 6 | git-stripspace - Remove unnecessary whitespace |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Martin von Zweigbergk | 7791a1d | 2011-07-01 22:38:26 -0400 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | 33e8fc8 | 2015-10-16 11:27:42 -0700 | [diff] [blame] | 12 | 'git stripspace' [-s | --strip-comments] |
| 13 | 'git stripspace' [-c | --comment-lines] |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 14 | |
| 15 | DESCRIPTION |
| 16 | ----------- |
Conrad Irwin | 497215d | 2011-12-12 15:52:51 -0800 | [diff] [blame] | 17 | |
Junio C Hamano | 33e8fc8 | 2015-10-16 11:27:42 -0700 | [diff] [blame] | 18 | Read text, such as commit messages, notes, tags and branch |
| 19 | descriptions, from the standard input and clean it in the manner |
| 20 | used by Git. |
Conrad Irwin | 497215d | 2011-12-12 15:52:51 -0800 | [diff] [blame] | 21 | |
| 22 | With 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 | |
| 29 | In the case where the input consists entirely of whitespace characters, no |
| 30 | output will be produced. |
| 31 | |
| 32 | *NOTE*: This is intended for cleaning metadata, prefer the `--whitespace=fix` |
| 33 | mode of linkgit:git-apply[1] for correcting whitespace of patches or files in |
| 34 | the repository. |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 35 | |
| 36 | OPTIONS |
| 37 | ------- |
Stephan Beyer | 3240240 | 2008-06-08 03:36:09 +0200 | [diff] [blame] | 38 | -s:: |
| 39 | --strip-comments:: |
Junio C Hamano | eff80a9 | 2013-01-16 20:18:48 +0100 | [diff] [blame] | 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. |
Johannes Schindelin | f653aee | 2007-07-23 12:58:27 +0100 | [diff] [blame] | 47 | |
Conrad Irwin | 497215d | 2011-12-12 15:52:51 -0800 | [diff] [blame] | 48 | EXAMPLES |
| 49 | -------- |
| 50 | |
| 51 | Given the following noisy input with '$' indicating the end of a line: |
| 52 | |
Jeff King | ad3967a | 2015-05-12 22:15:56 -0400 | [diff] [blame] | 53 | --------- |
Conrad Irwin | 497215d | 2011-12-12 15:52:51 -0800 | [diff] [blame] | 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 | |
| 67 | Use 'git stripspace' with no arguments to obtain: |
| 68 | |
Jeff King | ad3967a | 2015-05-12 22:15:56 -0400 | [diff] [blame] | 69 | --------- |
Conrad Irwin | 497215d | 2011-12-12 15:52:51 -0800 | [diff] [blame] | 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 | |
| 81 | Use 'git stripspace --strip-comments' to obtain: |
| 82 | |
Jeff King | ad3967a | 2015-05-12 22:15:56 -0400 | [diff] [blame] | 83 | --------- |
Conrad Irwin | 497215d | 2011-12-12 15:52:51 -0800 | [diff] [blame] | 84 | |A brief introduction$ |
| 85 | |$ |
| 86 | |A new paragraph$ |
| 87 | |explaining lots of stuff.$ |
| 88 | |$ |
| 89 | |The end.$ |
| 90 | --------- |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 91 | |
Junio C Hamano | 7fc9d69 | 2005-08-23 01:49:47 -0700 | [diff] [blame] | 92 | GIT |
| 93 | --- |
Christian Couder | 9e1f0a8 | 2008-06-06 09:07:32 +0200 | [diff] [blame] | 94 | Part of the linkgit:git[1] suite |