Progress:
TIER 2 · MODULE 27· Intermediate

git version

Sometimes the answer is 'upgrade'.

🎯 What & why

Print the installed Git version, optionally with the full set of compile-time options. The first thing to check when a feature 'doesn't work'.

🧠 Mental model

Git's behavior depends not just on version number but on what was compiled in: hash backend (SHA-1 vs SHA-256), TLS library, zlib, curl, and feature toggles. --build-options exposes that surface.

🛠️ Synopsis

git version [--build-options]
git --version

Prints 'git version X.Y.Z' to stdout. With --build-options, adds CPU,
sizeof-* values, hash backend (sha1: collisiondetect / openssl), and
selected library versions.

🎚️ Switches & options

FlagWhat it does
--build-optionsAppend compile-time details: CPU arch, sizeof-long/size_t, sha1/sha256 backend implementations.
(no args)Print just the version string.

💡 Use cases

🧪 Examples

Quick check
git version
Full build details
git version --build-options
Equivalent global flag
git --version
Script gate (require >= 2.23)
ver=$(git version | awk '{print $3}'); [ "$(printf '%s\n2.23.0\n' "$ver" | sort -V | head -1)" = "2.23.0" ] || echo 'upgrade git'

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.