diff --git a/src/interfaces/ecpg/test/.gitignore b/src/interfaces/ecpg/test/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..8d1c53904aed050a3a1699ab4676ce6e7a246792
--- /dev/null
+++ b/src/interfaces/ecpg/test/.gitignore
@@ -0,0 +1,9 @@
+/pg_regress
+
+# Exclude all C files in subdirectories
+/*/*.c
+
+# Exclude subdirectories
+/log/
+/results/
+/tmp_check/
diff --git a/src/interfaces/ecpg/test/compat_informix/.gitignore b/src/interfaces/ecpg/test/compat_informix/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1f6c33f88ed56217f14f2c12d9b9546218507ca1
--- /dev/null
+++ b/src/interfaces/ecpg/test/compat_informix/.gitignore
@@ -0,0 +1,3 @@
+# Exclude all non-pgc files
+*
+!*.pgc
diff --git a/src/interfaces/ecpg/test/connect/.gitignore b/src/interfaces/ecpg/test/connect/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1f6c33f88ed56217f14f2c12d9b9546218507ca1
--- /dev/null
+++ b/src/interfaces/ecpg/test/connect/.gitignore
@@ -0,0 +1,3 @@
+# Exclude all non-pgc files
+*
+!*.pgc
diff --git a/src/interfaces/ecpg/test/pgtypeslib/.gitignore b/src/interfaces/ecpg/test/pgtypeslib/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1f6c33f88ed56217f14f2c12d9b9546218507ca1
--- /dev/null
+++ b/src/interfaces/ecpg/test/pgtypeslib/.gitignore
@@ -0,0 +1,3 @@
+# Exclude all non-pgc files
+*
+!*.pgc
diff --git a/src/interfaces/ecpg/test/preproc/.gitignore b/src/interfaces/ecpg/test/preproc/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1f6c33f88ed56217f14f2c12d9b9546218507ca1
--- /dev/null
+++ b/src/interfaces/ecpg/test/preproc/.gitignore
@@ -0,0 +1,3 @@
+# Exclude all non-pgc files
+*
+!*.pgc
diff --git a/src/interfaces/ecpg/test/sql/.gitignore b/src/interfaces/ecpg/test/sql/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1f6c33f88ed56217f14f2c12d9b9546218507ca1
--- /dev/null
+++ b/src/interfaces/ecpg/test/sql/.gitignore
@@ -0,0 +1,3 @@
+# Exclude all non-pgc files
+*
+!*.pgc
diff --git a/src/interfaces/ecpg/test/thread/.gitignore b/src/interfaces/ecpg/test/thread/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..1f6c33f88ed56217f14f2c12d9b9546218507ca1
--- /dev/null
+++ b/src/interfaces/ecpg/test/thread/.gitignore
@@ -0,0 +1,3 @@
+# Exclude all non-pgc files
+*
+!*.pgc