diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild
index 868357fe58c4fded9d6ed54dba9269cd1845d2d6..1eb59cf46c4f71cacb12d5c40e961b0fcd388a9b 100755
--- a/wmake/wmakePrintBuild
+++ b/wmake/wmakePrintBuild
@@ -94,7 +94,7 @@ then
     rc=0
 else
     # building under git (get the head SHA1)
-    version=$(git show-ref --hash=12 --head HEAD 2>/dev/null)
+    version=$(git show-ref --hash=12 --head refs/heads/master 2>/dev/null)
     rc=$?
 
     # prefix with WM_PROJECT_VERSION