GH_PAGES = ../gh-pages
 
 all:
-       date +%F | zip -z cc65
+       echo $(TRAVIS_COMMIT) | zip -z cc65
 ifdef GH_TOKEN
        git clone --branch=gh-pages https://$(GH_TOKEN)@github.com/cc65/cc65.git $(GH_PAGES)
        cd $(GH_PAGES) && git config user.name "Oliver Schmidt"
 
   $(info USER_CFLAGS: $(USER_CFLAGS))
 endif
 
+ifndef GIT_SHA
+  GIT_SHA := $(if $(wildcard ../.git),$(shell git rev-parse --short HEAD))
+  ifneq ($(words $(GIT_SHA)),1)
+    GIT_SHA := N/A
+  endif
+endif
+$(info GIT_SHA: $(GIT_SHA))
+
 CFLAGS += -MMD -MP -O -I common \
           -Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
-          -DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
+          -DGIT_SHA=$(GIT_SHA) -DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
           -DLD65_LIB=$(LD65_LIB) -DLD65_OBJ=$(LD65_OBJ) -DLD65_CFG=$(LD65_CFG)
 
 LDLIBS += -lm
 
 
 
 
-#include "version.h"
+/* common */
 #include "xsprintf.h"
+#include "searchpath.h"
+#include "version.h"
 
 
 
 const char* GetVersionAsString (void)
 /* Returns the version number as a string in a static buffer */
 {
-    static char Buf[40];
-    xsnprintf (Buf, sizeof (Buf), "%u.%u - %s", VER_MAJOR, VER_MINOR, __DATE__);
+    static char Buf[60];
+#if defined(GIT_SHA)
+    xsnprintf (Buf, sizeof (Buf), "%u.%u - Git %s", VER_MAJOR, VER_MINOR, STRINGIZE (GIT_SHA));
+#else
+    xsnprintf (Buf, sizeof (Buf), "%u.%u", VER_MAJOR, VER_MINOR);
+#endif
     return Buf;
 }