?
This document uses PHP Chinese website manual Release
git-stripspace - 刪除不必要的空格
git stripspace [-s | --strip-comments]git stripspace [-c | --comment-lines]
從標(biāo)準(zhǔn)輸入中讀取提交消息,注釋,標(biāo)記和分支描述等文本,并按照 Git 使用的方式進(jìn)行清理。
沒有任何爭論,這將會:
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.
在輸入完全由空白字符組成的情況下,不會產(chǎn)生輸出。
注意:這是為了清理元數(shù)據(jù),更喜歡 git-apply [1] 的--whitespace=fix
模式來修正版本庫中補(bǔ)丁或文件的空白。
-s --strip-comments
跳過并刪除所有以注釋字符開頭的行(默認(rèn)#
)。
-c --comment-lines
在每行上添加注釋字符和空白。行將自動以換行符終止。在空行上,只有注釋字符會被預(yù)置。
鑒于以下帶有噪音的輸入,$
指示行的結(jié)尾:
|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
無參數(shù)來獲?。?/p>
|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.$