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

Re: someone changed the contents of my HEAD.

From
Junio C Hamano <junkio@cox.net>
Date
Feb 28, 2006, 05:22 UTC
Message-ID
<7vlkvwt5v9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060228030446.GA23490@redhat.com>
Dave Jones <davej@redhat.com> writes:
Show 8 quoted lines
> When checking in changes previously, I used this..
>
> #!/bin/sh
> export GIT_AUTHOR_NAME="$1"
> export GIT_AUTHOR_EMAIL="$2"
> tree=$(git-write-tree) || exit 1
> commit=$(git-commit-tree $tree -p HEAD) || exit 1
> echo $commit > .git/HEAD

This has been deprecated for a looong time, but perhaps I should have been louder. "git commit --author" should be fine -- I do not think you do not even need such a wrapper.

Show 6 quoted lines
> For my newly created repos, this isn't a problem, as I can fudge my
> commit-as script to write to .git/refs/heads/master instead, but
> my concern now is the unpulled changes in the existing repos
> I have on master.  Will Linus be able to pull those into his tree
> with git 1.2.3, or will I have to recreate those repos with the
> new-style .git/HEAD ?

A .git/HEAD symlink pointing at refs/heads/master _is_ still (and will be) supported, so either symlink or symref is fine. Bare SHA1 object name in HEAD is not -- git would not know which branch you are on, so "checkin" would not work after that.

Your refs/heads/master might be stale (one rev or more older than what you replaced .git/HEAD with) but still should be a proper ancestor. After making sure your refs/heads/master has the right commit (you may have it there already if you have been updating them using "git-push"), running "git-symbolic-ref HEAD refs/heads/master" would fix things.

Previous: Dave JonesNext: Dave Jones
Message 2 of 3 in “someone changed the contents of my HEAD.”
  1. Dave JonesFeb 28, 2006
  2. Junio C HamanoFeb 28, 2006
  3. Dave JonesFeb 28, 2006

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.