diff --git a/pgadmin/Makefile.am b/pgadmin/Makefile.am
index 9d8976f..a17caaf 100644
--- a/pgadmin/Makefile.am
+++ b/pgadmin/Makefile.am
@@ -12,7 +12,6 @@
 bin_PROGRAMS = pgadmin3
 
 pgadmin3_SOURCES = \
-	$(srcdir)/include/svnversion.cpp \
 	$(srcdir)/pgAdmin3.cpp 
 
 EXTRA_DIST = \
@@ -20,14 +19,11 @@ EXTRA_DIST = \
 	$(srcdir)/precomp.cpp \
 	$(srcdir)/pgAdmin3.rc \
 	$(srcdir)/ver_svn.bat
-	
-# Generate svnversion.h every time, but only if repo version has changed.
-.PHONY: $(srcdir)/include/svnversion.cpp
-$(srcdir)/include/svnversion.cpp:
-	test -f $(srcdir)/include/svnversion.cpp || touch $(srcdir)/include/svnversion.cpp
-	test -d $(srcdir)/.svn && ( V=`svnversion $(srcdir)/..` && OV=`cat $(srcdir)/include/svnversion.h | cut -d' ' -f3|tr -d '"'` ; if [ "$$V" != "$$OV" ]; then echo "#define VERSION_SVN \"$$V\"" > $(srcdir)/include/svnversion.h ; fi ) || true
-	test -f $(srcdir)/include/svnversion.h -o -d $(srcdir)/.git/svn || echo "#define VERSION_SVN \"$$(git svn info | grep Revision: | sed -e 's/Revision: //'):$$(git svn info | grep Last\ Changed\ Rev: | sed -e 's/Last Changed Rev: //')\"" > $(srcdir)/include/svnversion.h
-	test -f $(srcdir)/include/svnversion.h || echo "#define VERSION_SVN \"unknown\"" > $(srcdir)/include/svnversion.h
+
+# Make sure we always have these dependencies, even if dependency tracking
+# is turend off.  The leading dash keeps automake from trying to process this.
+-include Makefile.deps
+
 TMP_ui = 
 
 # Include all the sub-Makefiles
diff --git a/pgadmin/frm/module.mk b/pgadmin/frm/module.mk
index c04b346..730e680 100644
--- a/pgadmin/frm/module.mk
+++ b/pgadmin/frm/module.mk
@@ -36,5 +36,3 @@ pgadmin3_SOURCES += \
 
 EXTRA_DIST += \
     $(srcdir)/frm/module.mk
-
-
diff --git a/pgadmin/ver_svn.bat b/pgadmin/ver_svn.bat
index 270e488..796d9cd 100755
--- a/pgadmin/ver_svn.bat
+++ b/pgadmin/ver_svn.bat
@@ -3,7 +3,11 @@
 set V=
 set OV=
 
-if not exist .svn goto nosvn
+REM *****************************************
+REM Get the SVN revision
+REM *****************************************
+
+if not exist .svn goto git
 
 if exist include\svnversion.h for /f "tokens=3" %%f in (include\svnversion.h) do set OV=%%f
 
@@ -15,12 +19,39 @@ echo Generating svnversion.h for revision %V%.
 echo #define VERSION_SVN "%V%" > include\svnversion.h
 goto :eof
 
+REM *****************************************
+REM Get the GIT revision
+REM *****************************************
+
+:git
+
+if not exist ..\.git goto nosvnorgit
+
+if exist include\svnversion.h for /f "tokens=3" %%f in (include\svnversion.h) do set OV=%%f
+
+for /f %%f in ('git describe --always') do set V=%%f
+
+if "%V%"==%OV% goto same
+
+echo Generating svnversion.h for revision %V%.
+echo #define VERSION_SVN "%V%" > include\svnversion.h
+goto :eof
+
+REM *****************************************
+REM No change...
+REM *****************************************
+
 :same
 echo Not generating svnversion.h, not changed.
 goto :eof
 
-:nosvn
-echo Not generating svnversion.h, not working in a svn checkout.
+REM *****************************************
+REM No source control
+REM *****************************************
+
+:nosvnorgit
+echo Not generating svnversion.h, not working in a svn or git checkout.
 if not exist include\svnversion.h echo #define VERSION_SVN "unknown" > include\svnversion.h
 goto :eof
 
+
diff --git a/pgadmin/ver_svn.sh b/pgadmin/ver_svn.sh
index 0841438..68ee0ec 100755
--- a/pgadmin/ver_svn.sh
+++ b/pgadmin/ver_svn.sh
@@ -1,13 +1,18 @@
 #!/bin/sh
 
 OV=unknown
-if [ -d .svn ]; then
+if [ -d .svn -o -d ../.git ]; then
    if [ -f include/svnversion.h ]; then
       OV=$(cat include/svnversion.h | sed -e 's/#define VERSION_SVN "\(.*\)"/\1/')
    fi
 fi
 
-NV=$(svnversion ..)
+if [ -d .svn ]; then
+   NV=$(svnversion ..)
+elif [ -d ../.git ]; then
+   NV=$(git describe --always)
+fi
+
 
 if [ "$OV" != "$NV" ]; then
    echo Refreshing svnversion.h
