目录搜索
GuidesgitattributesgiteverydaygitglossarygitignoregitmodulesgitrevisionsgittutorialgitworkflowsAdministrationgit archivegit bundlegit cleangit filter-branchgit fsckgit gcgit instawebgit reflogBasic Snapshottinggit addgit commitgit diffgit mvgit resetgit rmgit statusBranching and Merginggit branchgit checkoutgit loggit mergegit mergetoolgit stashgit tagDebugginggit bisectgit blamegit grepEmailgit amgit format-patchgit request-pullgit send-emailExternal Systemsgit fast-importgit svnGetting and Creating Projectsgit clonegit initGitgit annotategit archimportgit bisect-lk2009git check-attrgit check-mailmapgit check-ref-formatgit checkout-indexgit cherrygit citoolgit columngit credentialgit credential-cachegit credential-storegit cvsexportcommitgit cvsimportgit cvsservergit diff-filesgit diff-treegit difftoolgit fast-exportgit fetch-packgit fmt-merge-msggit get-tar-commit-idgit guigit http-backendgit http-fetchgit http-pushgit imap-sendgit index-packgit interpret-trailersgit ls-remotegit ls-treegit mailinfogit mailsplitgit merge-filegit merge-indexgit merge-one-filegit merge-treegit mktaggit mktreegit name-revgit notesgit p4git pack-objectsgit pack-redundantgit pack-refsgit parse-remotegit patch-idgit prunegit prune-packedgit quiltimportgit receive-packgit remote-extgit remote-fdgit remote-testgitgit repackgit replacegit rereregit send-packgit sh-i18ngit sh-setupgit shellgit show-branchgit show-indexgit stripspacegit unpack-filegit unpack-objectsgit upload-archivegit upload-packgit vargit verify-commitgit verify-taggit whatchangedgit worktreeInspection and Comparisongit describegit shortloggit showMiscellaneousapi credentialsapi indexgitcligitcore tutorialgitcredentialsgitcvs migrationgitdiffcoregithooksgitkgitnamespacesgitremote helpersgitrepository layoutgitsubmodulesgittutorial 2gitwebgitweb.confpack formatUser ManualPatchinggit applygit cherry-pickgit rebasegit revertPlumbing Commandsgit cat-filegit check-ignoregit commit-treegit count-objectsgit diff-indexgit for-each-refgit hash-objectgit ls-filesgit merge-basegit read-treegit rev-listgit rev-parsegit show-refgit symbolic-refgit update-indexgit update-refgit verify-packgit write-treeServer Admingit daemongit update-server-infoSetup and Configgitgit configgit helpSharing and Updating Projectsgit fetchgit pullgit pushgit remotegit submodule
文字

名称

git-stripspace  - 删除不必要的空格

概要

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

描述

从标准输入中读取提交消息,注释,标记和分支描述等文本,并按照 Git 使用的方式进行清理。

没有任何争论,这将会:

  • 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.

在输入完全由空白字符组成的情况下,不会产生输出。

注意:这是为了清理元数据,更喜欢 git-apply [1] 的--whitespace=fix模式来修正版本库中补丁或文件的空白。

选项

-s   --strip-comments

跳过并删除所有以注释字符开头的行(默认#)。

-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.$
上一篇:下一篇: