| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-stripspace(1) |
| 2 | ================= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| Junio C Hamano | 0df9271 | 2011-12-21 22:30:44 | [diff] [blame] | 6 | git-stripspace - Remove unnecessary whitespace |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
| Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 11 | [verse] |
| Junio C Hamano | 0df9271 | 2011-12-21 22:30:44 | [diff] [blame] | 12 | 'git stripspace' [-s | --strip-comments] < input |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
| Junio C Hamano | 0df9271 | 2011-12-21 22:30:44 | [diff] [blame] | 16 | |
| Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 17 | Clean the input in the manner used by Git for text such as commit |
| Junio C Hamano | 0df9271 | 2011-12-21 22:30:44 | [diff] [blame] | 18 | messages, notes, tags and branch descriptions. |
| 19 | |
| 20 | With no arguments, this will: |
| 21 | |
| 22 | - remove trailing whitespace from all lines |
| 23 | - collapse multiple consecutive empty lines into one empty line |
| 24 | - remove empty lines from the beginning and end of the input |
| 25 | - add a missing '\n' to the last line if necessary. |
| 26 | |
| 27 | In the case where the input consists entirely of whitespace characters, no |
| 28 | output will be produced. |
| 29 | |
| 30 | *NOTE*: This is intended for cleaning metadata, prefer the `--whitespace=fix` |
| 31 | mode of linkgit:git-apply[1] for correcting whitespace of patches or files in |
| 32 | the repository. |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 33 | |
| 34 | OPTIONS |
| 35 | ------- |
| Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 36 | -s:: |
| 37 | --strip-comments:: |
| Junio C Hamano | 3f2ed6f | 2013-02-04 19:24:09 | [diff] [blame] | 38 | Skip and remove all lines starting with comment character (default '#'). |
| 39 | |
| 40 | -c:: |
| 41 | --comment-lines:: |
| 42 | Prepend comment character and blank to each line. Lines will automatically |
| 43 | be terminated with a newline. On empty lines, only the comment character |
| 44 | will be prepended. |
| Junio C Hamano | b1d6e88 | 2007-08-11 08:30:16 | [diff] [blame] | 45 | |
| Junio C Hamano | 0df9271 | 2011-12-21 22:30:44 | [diff] [blame] | 46 | EXAMPLES |
| 47 | -------- |
| 48 | |
| 49 | Given the following noisy input with '$' indicating the end of a line: |
| 50 | |
| 51 | -------- |
| 52 | |A brief introduction $ |
| 53 | | $ |
| 54 | |$ |
| 55 | |A new paragraph$ |
| 56 | |# with a commented-out line $ |
| 57 | |explaining lots of stuff.$ |
| 58 | |$ |
| 59 | |# An old paragraph, also commented-out. $ |
| 60 | | $ |
| 61 | |The end.$ |
| 62 | | $ |
| 63 | --------- |
| 64 | |
| 65 | Use 'git stripspace' with no arguments to obtain: |
| 66 | |
| 67 | -------- |
| 68 | |A brief introduction$ |
| 69 | |$ |
| 70 | |A new paragraph$ |
| 71 | |# with a commented-out line$ |
| 72 | |explaining lots of stuff.$ |
| 73 | |$ |
| 74 | |# An old paragraph, also commented-out.$ |
| 75 | |$ |
| 76 | |The end.$ |
| 77 | --------- |
| 78 | |
| 79 | Use 'git stripspace --strip-comments' to obtain: |
| 80 | |
| 81 | -------- |
| 82 | |A brief introduction$ |
| 83 | |$ |
| 84 | |A new paragraph$ |
| 85 | |explaining lots of stuff.$ |
| 86 | |$ |
| 87 | |The end.$ |
| 88 | --------- |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 89 | |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 90 | GIT |
| 91 | --- |
| Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 92 | Part of the linkgit:git[1] suite |