diff --git a/.editorconfig b/.editorconfig
index 30740e726616..306d282c3164 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -6,6 +6,9 @@ root = true
 insert_final_newline = true
 trim_trailing_whitespace = true
 
+[*.{diff,patch}]
+trim_trailing_whitespace = false
+
 [*.{sh,pl,xml}]
 indent_size = 4
 indent_style = space
