git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git reflog write does not pick up user.name and user.email from config

From
MMichael <gitmlko@not-evil.de>
Date
Sep 29, 2025, 11:11 UTC
Message-ID
<519E887F-2028-476E-B26D-85E23F7974A5@not-evil.de>
Hi there!

I've been playing around with a toy project (an interactive step by step git tutorial that is just a repo) where I have been creating a reflog manually so far. I was happy to see the new `reflog write` feature and wanted to integrate it.

When comparing the results of my hand made reflog with the new `git reflog write` result I found some differences: It does not seem to pick up the "user.name" and "user.email" from the local git config.

Example:

```bash git init example && cd example git config --local user.name "C O Mitter" git config --local user.email "committer@example.com"

message="hi" oid="0000000000000000000000000000000000000000"

# Setting env vars works as expected
GIT_COMMITTER_NAME="$(git config --get user.name)" \
  GIT_COMMITTER_EMAIL="$(git config --get user.email)" \
  git reflog write "refs/test_vars" "$oid" "$oid" "$message"

# Picking up the information from the local config does not work unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL git reflog write "refs/test_no_vars" "$oid" "$oid" "$message"

# Since setting the env variables to the config value, no diff expected # but: diff .git/logs/refs/test_* # 1c1 # < 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 Michael <michael@mycomp.local> 1759142076 +0200 hi # --- # > 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 C O Mitter <committer@example.com> 1759142076 +0200 hi ```

Intuitively I would expect these values to be picked up from the local config instead of having to specify them in env variables. I didn't expect it to fall back to some system values, instead of git config. Is there a reason that this information is not used from the config? And if yes, could you set some config, so that it gets picked up?

Unfortunately my ability to understand C is too limited to grasp how `git_committer_info` works…

Thanks a lot for your work! Michael

Next: Patrick Steinhardt
Message 1 of 9 in “git reflog write does not pick up user.name and user.email from config”
  1. MichaelSep 29, 2025
  2. Patrick SteinhardtSep 29, 2025
  3. builtin/reflog: respect user config in "write" subcommandgitmlko@not-evil.de, Sep 30, 2025
  4. Patrick SteinhardtSep 30, 2025
  5. builtin/reflog: respect user config in "write" subcommandgit@lohmann.sh, Sep 30, 2025
  6. Junio C HamanoSep 30, 2025
  7. builtin/reflog: respect user config in "write" subcommandMichael Lohmann, Sep 30, 2025
  8. Patrick SteinhardtOct 1, 2025
  9. Junio C HamanoOct 1, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.