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