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

HEAD's reflog entry for a renamed branch

From
Kyle Meyer <kyle@kyleam.com>
Date
Jan 16, 2017, 23:17 UTC
Message-ID
<87pojmwq5y.fsf@kyleam.com>
Hello,

I noticed that, after renaming the current branch, the corresponding message in .git/logs/HEAD is empty.

For example, running
    $ mkdir test-repo
    $ cd test-repo
    $ git init
    $ echo abc >file.txt
    $ git add file.txt
    $ git commit -m"Add file.txt"
    $ git branch -m master new-master
resulted in the following reflogs:
   $ cat .git/logs/refs/heads/new-master
   00000... 68730... Kyle Meyer <kyle@kyleam.com> 1484607020 -0500	commit (initial): Add file.txt
   68730... 68730... Kyle Meyer <kyle@kyleam.com> 1484607020 -0500	Branch: renamed refs/heads/master to refs/heads/new-master
   $ cat .git/logs/HEAD
   00000... 68730... Kyle Meyer <kyle@kyleam.com> 1484607020 -0500	commit (initial): Add file.txt
   68730... 00000... Kyle Meyer <kyle@kyleam.com> 1484607020 -0500

I expected the second line of .git/logs/HEAD to mirror the second line of .git/logs/refs/heads/new-master. Are the empty message and null sha1 in HEAD's entry intentional?

-- Kyle

Next: Jeff King
Message 1 of 36 in “HEAD's reflog entry for a renamed branch”
  1. Kyle MeyerJan 16, 2017
  2. Jeff KingJan 26, 2017
  3. Junio C HamanoJan 26, 2017
  4. Jeff KingJan 26, 2017
  5. 0/3 delete_ref(): support reflog messagesKyle Meyer, Feb 17, 2017
  6. 1/3 delete_refs(): accept a reflog message argumentKyle Meyer, Feb 17, 2017
  7. Jeff KingFeb 17, 2017
  8. Junio C HamanoFeb 17, 2017
  9. Kyle MeyerFeb 17, 2017
  10. 2/3 update-ref: pass reflog message argument to delete_refsKyle Meyer, Feb 17, 2017
  11. Jeff KingFeb 17, 2017
  12. Junio C HamanoFeb 17, 2017
  13. Kyle MeyerFeb 17, 2017
  14. Jeff KingFeb 17, 2017
  15. 3/3 rename_ref: replace empty deletion message in HEAD's logKyle Meyer, Feb 17, 2017
  16. Jeff KingFeb 17, 2017
  17. Junio C HamanoFeb 17, 2017
  18. Jeff KingFeb 17, 2017
  19. Jeff KingFeb 17, 2017
  20. Junio C HamanoFeb 17, 2017
  21. Kyle MeyerFeb 17, 2017
  22. Kyle MeyerFeb 17, 2017
  23. Jeff KingFeb 17, 2017
  24. Junio C HamanoFeb 17, 2017
  25. Jeff KingFeb 17, 2017
  26. 0/4 delete_ref: support reflog messagesKyle Meyer, Feb 21, 2017
  27. 1/4 delete_ref: accept a reflog message argumentKyle Meyer, Feb 21, 2017
  28. Duy NguyenFeb 23, 2017
  29. Junio C HamanoFeb 23, 2017
  30. Kyle MeyerFeb 25, 2017
  31. 2/4 update-ref: pass reflog message to delete_ref()Kyle Meyer, Feb 21, 2017
  32. 4/4 branch: record creation of renamed branch in HEAD's logKyle Meyer, Feb 21, 2017
  33. 3/4 rename_ref: replace empty message in HEAD's logKyle Meyer, Feb 21, 2017
  34. Jeff KingFeb 21, 2017
  35. Junio C HamanoFeb 21, 2017
  36. Kyle MeyerFeb 21, 2017

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.