diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index de74fb01bb81ac..572d27cfef9ff8 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -415,8 +415,8 @@
-
-
+
+
$([System.IO.File]::ReadAllText('$(IntDir)gitbranch.txt').Trim())
$([System.IO.File]::ReadAllText('$(IntDir)gitversion.txt').Trim())
diff --git a/configure b/configure
index 67cd4f4fa37f29..f596fd870a04f0 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 6e78bb64d7e951..aca8255f2db4b1 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=""