diff --git a/.gitignore b/.gitignore
index d3d73615bac1..f6d1d68e4a7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: CC0-1.0
 
-__pycache__/
-build/
-patches/
+/build/
+/patches/
+
 *.patch
 *.pyc
+__pycache__/
