{"id":1595,"date":"2026-01-02T17:56:46","date_gmt":"2026-01-02T15:56:46","guid":{"rendered":"https:\/\/blog.the-leviathan.ch\/?p=1595"},"modified":"2026-01-02T17:56:46","modified_gmt":"2026-01-02T15:56:46","slug":"fixing-white-space-issues-in-git","status":"publish","type":"post","link":"https:\/\/blog.the-leviathan.ch\/?p=1595","title":{"rendered":"Fixing white space issues in GIT"},"content":{"rendered":"\n<p>I just found the command for cleaning up my changes before committing them into my GIT repo<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for FILE in `git diff --check | sed '\/^&#91;+-]\/d' | sed -r 's\/:&#91;0-9]+:.*\/\/' | uniq`; do sed -i 's\/&#91;&#91;:space:]]*$\/\/' \"$FILE\"; done<\/code><\/pre>\n\n\n\n<p>This will clean up all trailing spaces and make the spaces which are highlighted red when running <em>git diff<\/em> go away<\/p>\n\n\n\n<p>Just wanted to note it down somewhere<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just found the command for cleaning up my changes before committing them into my GIT repo This will clean up all trailing spaces and make the spaces which are highlighted red when running git diff go away Just wanted to note it down somewhere<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1595","post","type-post","status-publish","format-standard","hentry","category-daily"],"_links":{"self":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1595"}],"version-history":[{"count":2,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1595\/revisions"}],"predecessor-version":[{"id":1598,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1595\/revisions\/1598"}],"wp:attachment":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}