English ▾
Localized versions of git-stripspace manual
  1. English
  2. Português (Brasil)
  3. українська мова
  4. 简体中文
Topics ▾ Version 2.4.12 ▾ git-stripspace last updated in 2.50.0
Changes in the git-stripspace manual
  1. 2.50.1 → 2.52.0 no changes
  2. 2.50.0 2025年06月16日
  3. 2.43.1 → 2.49.1 no changes
  4. 2.43.0 2023年11月20日
  5. 2.7.6 → 2.42.4 no changes
  6. 2.6.7 2017年05月05日
  7. 2.5.6 no changes
  8. 2.4.12 2017年05月05日
  9. 2.3.10 2015年09月28日
  10. 2.1.4 → 2.2.3 no changes
  11. 2.0.5 2014年12月17日

Check your version of git by running

git --version

NAME

git-stripspace - Remove unnecessary whitespace

SYNOPSIS

git stripspace [-s | --strip-comments] < input
git stripspace [-c | --comment-lines] < input

DESCRIPTION

Clean the input in the manner used by Git for text such as commit messages, notes, tags and branch descriptions.

With no arguments, this will:

  • remove trailing whitespace from all lines

  • collapse multiple consecutive empty lines into one empty line

  • remove empty lines from the beginning and end of the input

  • add a missing \n to the last line if necessary.

In the case where the input consists entirely of whitespace characters, no output will be produced.

NOTE: This is intended for cleaning metadata, prefer the --whitespace=fix mode of git-apply[1] for correcting whitespace of patches or files in the repository.

OPTIONS

-s
--strip-comments

Skip and remove all lines starting with comment character (default #).

-c
--comment-lines

Prepend comment character and blank to each line. Lines will automatically be terminated with a newline. On empty lines, only the comment character will be prepended.

EXAMPLES

Given the following noisy input with $ indicating the end of a line:

|A brief introduction $
| $
|$
|A new paragraph$
|# with a commented-out line $
|explaining lots of stuff.$
|$
|# An old paragraph, also commented-out. $
| $
|The end.$
| $

Use git stripspace with no arguments to obtain:

|A brief introduction$
|$
|A new paragraph$
|# with a commented-out line$
|explaining lots of stuff.$
|$
|# An old paragraph, also commented-out.$
|$
|The end.$

Use git stripspace --strip-comments to obtain:

|A brief introduction$
|$
|A new paragraph$
|explaining lots of stuff.$
|$
|The end.$

GIT

Part of the git[1] suite

AltStyle によって変換されたページ (->オリジナル) /