Trim whitespace from a file

git stripspace

  • Read text (e.g. commit messages, notes, tags, and branch descriptions) from the standard input and clean it into the manner used by Git.
    More information: <https://git-scm.com/docs/git-stripspace>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

cat {{path/to/file}} | git stripspace

click the source code to copy install git stripspace on any operating system with command-not-found.com