Now it's more clear which files are ignored because they are generated by autogen.sh and autoreconf. These commands also generated some files which were not ignored, so I added these to the ignore files.
.libs
.deps
libtool
-libltdl
-m4
-configure
Makefile
-Makefile.in
-autom4te.cache
COPYING
Doxyfile
doxygen
-INSTALL
-aclocal.m4
-version.m4
builddate.h
stamp-h1
FEATURE
windows/Properties/AssemblyInfo.cs
windows/build/graphviz.wxs
+# Files generated by autogen.sh and autoreconf
+*.m4
+!m4/glib-gettext.m4
+!m4/ming.m4
+!m4/iconv.m4
+!m4/lib-ld.m4
+!m4/lib-link.m4
+!m4/lib-prefix.m4
+!lib/gd/aclocal.m4
+config/**
+!config/config_*
+!config/config.rpath
+libltdl/**
+/autom4te.cache
+/config.h.in
+/configure
+/INSTALL
+Makefile.in
+
# Ignore folders generated by Visual Studio builds
**/Debug/**
**/Release/**
.libs
.deps
libtool
-libltdl
-m4
-configure
Makefile
-Makefile.in
-autom4te.cache
COPYING
Doxyfile
doxygen
-INSTALL
-aclocal.m4
-version.m4
builddate.h
stamp-h1
FEATURE
windows/Properties/AssemblyInfo.cs
windows/build/graphviz.wxs
+# Files generated by autogen.sh and autoreconf
+*.m4
+!m4/glib-gettext.m4
+!m4/ming.m4
+!m4/iconv.m4
+!m4/lib-ld.m4
+!m4/lib-link.m4
+!m4/lib-prefix.m4
+!lib/gd/aclocal.m4
+config/**
+!config/config_*
+!config/config.rpath
+libltdl/**
+/autom4te.cache
+/config.h.in
+/configure
+/INSTALL
+Makefile.in
+
# Ignore folders generated by Visual Studio builds
**/Debug/**
**/Release/**