diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index d7e9473638c..6ea184877f9 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -414,8 +414,8 @@
-
-
+
+
$([System.IO.File]::ReadAllText('$(IntDir)gitbranch.txt').Trim())
$([System.IO.File]::ReadAllText('$(IntDir)gitversion.txt').Trim())
diff --git a/configure b/configure
index d4eccb1d68d..abe1dc5abd4 100755
--- a/configure
+++ b/configure
@@ -2743,8 +2743,8 @@ HAS_GIT=no-repository
fi
if test $HAS_GIT = found
then
- GITVERSION="git -C \$(srcdir) rev-parse HEAD"
- GITTAG="git -C \$(srcdir) name-rev --tags --name-only HEAD"
+ GITVERSION="git -C \$(srcdir) rev-parse --short HEAD"
+ GITTAG="git -C \$(srcdir) describe --all --always --dirty"
GITBRANCH="git -C \$(srcdir) name-rev --name-only HEAD"
else
GITVERSION=""
diff --git a/configure.ac b/configure.ac
index f00a2a6fa49..9eacf52559e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,8 +37,8 @@ HAS_GIT=no-repository
fi
if test $HAS_GIT = found
then
- GITVERSION="git -C \$(srcdir) rev-parse HEAD"
- GITTAG="git -C \$(srcdir) name-rev --tags --name-only HEAD"
+ GITVERSION="git -C \$(srcdir) rev-parse --short HEAD"
+ GITTAG="git -C \$(srcdir) describe --all --always --dirty"
GITBRANCH="git -C \$(srcdir) name-rev --name-only HEAD"
else
GITVERSION=""