日本語 ▾ トピック ▾ 最新バージョン ▾ git-stripspace 最終更新日: 2.50.0

名前

git-stripspace - 不要な空白文字を削除する

概要

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

説明

コミットメッセージ、注釈、タグ、ブランチの説明などのテキストを標準入力から読み込み、Gitで使用される方法でクリーンアップします。

引数なしの場合、以下の処理が行われます。

  • すべての行末の空白文字を削除する

  • 複数の連続した空行を1つの空行にまとめる

  • 入力の先頭と末尾の空行を削除する

  • 必要に応じて、最終行に不足している \n を追加する

入力がすべて空白文字で構成されている場合、出力は生成されません。

: これはメタデータのクリーンアップを目的としています。リポジトリ内のパッチやファイルの空白文字を修正するには、git-apply[1]--whitespace=fix モードを使用することを推奨します。

オプション

-s
--strip-comments

コメント文字 (core.commentChar、デフォルトは #) で始まるすべての行をスキップして削除します。

-c
--comment-lines

各行の先頭にコメント文字と空白文字を追加します。行は自動的に改行で終了します。空行の場合、コメント文字のみが追加されます。

行の終わりを示す $ が付いた以下のノイズの多い入力があるとします。

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

引数なしで git stripspace を使用すると、以下が得られます。

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

git stripspace --strip-comments を使用すると、以下が得られます。

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

GIT

git[1]スイートの一部

scroll-to-top