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

Re: [SOLVED] `git fetch tag NAME' into mirror repo does not update HEAD, what to do?

From
Tomas Carnecky <tom@dbservice.com>
Date
Aug 12, 2010, 12:32 UTC
Message-ID
<4C63E9E9.7070105@dbservice.com>
In-Reply-To
<201008121416.35887.brian.foster@innova-card.com>
On 8/12/10 2:16 PM, Brian Foster wrote:
Show 11 quoted lines
>  NO.  ‘get checkout ...’ does not work in a bare repository.
>  (You can modify my trivial posted script to prove this.)
> 
>  However, your comment got me to thinking.  This _does_ work:
> 
>     git reset --soft FETCH_HEAD
> 
>  (And, I presume without testing, so would ‘... v2’ ?)
>  Given that git-reset(1)'s purpose is to change the branch's
>  head (or to change HEAD as I've been incorrectly describing
>  it), that does make sense.

I expected git checkout to work even in a bare repo - as you can see I don't work that often inside bare repos :).

You should use update-ref instead of reset. The problem with reset is that it changes the branch and not HEAD. Say initially your mirror had HEAD as symref pointing to refs/heads/master. When you run reset --soft v2 your master branch will now point to the same commit as the tag v2 (and HEAD will be still pointing to refs/heads/master). When you use 'git update-ref --no-deref HEAD v2' it will modify HEAD directly and have it point directly to the same commit as v2 (also called detached HEAD).

tom
Previous: Brian FosterNext: Brian Foster
Message 6 of 11 in “[Q] `git fetch tag NAME' into mirror repo does not update HEAD, what to do?”
  1. Brian FosterAug 12, 2010
  2. Tomas CarneckyAug 12, 2010
  3. Brian FosterAug 12, 2010
  4. Tomas CarneckyAug 12, 2010
  5. [SOLVED] `git fetch tag NAME' into mirror repo does not update HEAD, what to do?Brian Foster, Aug 12, 2010
  6. Tomas CarneckyAug 12, 2010
  7. Brian FosterAug 12, 2010
  8. Tomas CarneckyAug 12, 2010
  9. Brian FosterAug 13, 2010
  10. Brandon CaseyAug 12, 2010
  11. Brian FosterAug 13, 2010

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.