diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 488e7812f94..ffa3fa55101 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -38,6 +38,7 @@
 # See https://pre-commit.com/hooks.html for more hooks
 
 minimum_pre_commit_version: 3.2.0
+default_install_hook_types: [pre-commit, commit-msg]
 repos:
   - repo: https://github.com/psf/black-pre-commit-mirror
     rev: 25.1.0
@@ -80,3 +81,10 @@ repos:
       # All gdb header files, but not headers in the test suite.
       files: '^(gdb(support|server)?)/.*\.h$'
       exclude: '.*/testsuite/.*'
+    - id: codespell-log
+      name: codespell-log
+      language: script
+      entry: gdb/contrib/codespell-log.sh
+      verbose: true
+      always_run: true
+      stages: [commit-msg]
diff --git a/gdb/contrib/codespell-log.sh b/gdb/contrib/codespell-log.sh
new file mode 100755
index 00000000000..380d34025ef
--- /dev/null
+++ b/gdb/contrib/codespell-log.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+gen_cfg ()
+{
+    cat > "$1" <<EOF
+repos:
+- repo: https://github.com/codespell-project/codespell
+  rev: v2.4.1
+  hooks:
+  - id: codespell
+    name: codespell-log-internal
+    stages: [manual]
+EOF
+}
+
+cfg=$(mktemp)
+
+gen_cfg $cfg
+
+pre-commit \
+    run \
+    -c "$cfg" \
+    codespell \
+    --hook-stage manual \
+    --files "$@" \
+    || true
+
+rm -f \
+   "$cfg"
