snippetbashTip
git stripspace — Read text (e.g. commit messages, notes, tags, and branch descriptions) from `stdin` and clean it int
Viewed 0 times
commandtextcommitreadgit stripspaceclimessagesnotes
Problem
How to use the
git stripspace command: Read text (e.g. commit messages, notes, tags, and branch descriptions) from stdin and clean it into the manner used by Git. More information: <https://git-scm.com/docs/git-stripspace>.Solution
git stripspace — Read text (e.g. commit messages, notes, tags, and branch descriptions) from stdin and clean it into the manner used by Git. More information: <https://git-scm.com/docs/git-stripspace>.Trim whitespace from a file:
cat {{path/to/file}} | git stripspaceTrim whitespace and Git comments from a file:
cat {{path/to/file}} | git stripspace {{[-s|--strip-comments]}}Convert all lines in a file into Git comments:
git < {{path/to/file}} stripspace {{[-c|--comment-lines]}}Code Snippets
Trim whitespace from a file
cat {{path/to/file}} | git stripspaceTrim whitespace and Git comments from a file
cat {{path/to/file}} | git stripspace {{[-s|--strip-comments]}}Convert all lines in a file into Git comments
git < {{path/to/file}} stripspace {{[-c|--comment-lines]}}Context
tldr-pages: common/git stripspace
Revisions (0)
No revisions yet.