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

Re: with git update-ref?

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 11, 2024, 21:28 UTC
Message-ID
<xmqqa5facosb.fsf@gitster.g>
In-Reply-To
<D4TA5EXQFFA0.1XVEK1RM2Q6VA@ferdinandy.com>
"Bence Ferdinandy" <bence@ferdinandy.com> writes:
Show 17 quoted lines
> On Fri Oct 11, 2024 at 22:56, Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> wrote:
>> `ref: refs/remotes/origin/test`? (space after colon)
>
> I tried a couple of variations and no:
>
> ❯ git update-ref --no-deref refs/remotes/origin/HEAD 'ref: refs/remotes/origin/test'
> fatal: ref: refs/remotes/origin/test: not a valid SHA1
> ❯ git update-ref refs/remotes/origin/HEAD 'ref: refs/remotes/origin/test'
> fatal: ref: refs/remotes/origin/test: not a valid SHA1
> ❯ git update-ref --no-deref refs/remotes/origin/HEAD 'ref:refs/remotes/origin/test'
> fatal: ref:refs/remotes/origin/test: not a valid SHA1
> ❯ git update-ref  refs/remotes/origin/HEAD 'ref:refs/remotes/origin/test'
> fatal: ref:refs/remotes/origin/test: not a valid SHA1
>
> I guess the intended way of doing this is via git symbolic-ref anyway, but I'm
> curious if this should work somehow or I'm misinterpreting the meaning of that
> sentence.

I do not think update-ref is a tool to modify a symbolic-ref. Moreover, the mention of "ref:" is meant to be for those who are overly curious for their own good and go peek into their .git/ directory; script writers should not have to know such an implementation detail.

: ask what the current state is. $ git symbolic-ref refs/remotes/origin/HEAD fatal: ref refs/remotes/origin/HEAD is not a symbolic ref

: set it $ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

: inspect the result $ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master

Thanks.
Previous: Bence FerdinandyNext: Bence Ferdinandy
Message 4 of 54 in “ref: with git update-ref?”
  1. Bence FerdinandyOct 11, 2024
  2. Kristoffer HaugsbakkOct 11, 2024
  3. Bence FerdinandyOct 11, 2024
  4. Junio C HamanoOct 11, 2024
  5. Bence FerdinandyOct 12, 2024
  6. Phillip WoodOct 13, 2024
  7. Kristoffer HaugsbakkOct 13, 2024
  8. karthik nayakOct 13, 2024
  9. Kristoffer HaugsbakkOct 13, 2024
  10. Bence FerdinandyOct 13, 2024
  11. Kristoffer HaugsbakkOct 14, 2024
  12. 0/6 doc: update-ref: amend old material and discuss symrefskristofferhaugsbakk@fastmail.com, Oct 15, 2024
  13. 1/6 doc: update-ref: drop “flag”kristofferhaugsbakk@fastmail.com, Oct 15, 2024
  14. Taylor BlauOct 16, 2024
  15. Eric SunshineOct 16, 2024
  16. Taylor BlauOct 16, 2024
  17. Kristoffer HaugsbakkOct 17, 2024
  18. Eric SunshineOct 17, 2024
  19. Taylor BlauOct 17, 2024
  20. 2/6 doc: update-ref: remove safety paragraphskristofferhaugsbakk@fastmail.com, Oct 15, 2024
  21. Taylor BlauOct 16, 2024
  22. 3/6 doc: update-ref: demote symlink to last sectionkristofferhaugsbakk@fastmail.com, Oct 15, 2024
  23. 4/6 doc: update-ref: remove confusing paragraphkristofferhaugsbakk@fastmail.com, Oct 15, 2024
  24. Taylor BlauOct 16, 2024
  25. Kristoffer HaugsbakkOct 16, 2024
  26. Taylor BlauOct 16, 2024
  27. 5/6 doc: update-ref: discuss symbolic linkskristofferhaugsbakk@fastmail.com, Oct 15, 2024
  28. Kristoffer HaugsbakkOct 15, 2024
  29. Taylor BlauOct 16, 2024
  30. 6/6 doc: mutually link update-ref and symbolic-refkristofferhaugsbakk@fastmail.com, Oct 15, 2024
  31. Bence FerdinandyOct 16, 2024
  32. Taylor BlauOct 16, 2024
  33. Kristoffer HaugsbakkOct 16, 2024
  34. 0/6 doc: update-ref: amend old material and discuss symrefskristofferhaugsbakk@fastmail.com, Oct 19, 2024
  35. 1/6 Documentation/git-update-ref.txt: drop “flag”kristofferhaugsbakk@fastmail.com, Oct 19, 2024
  36. karthik nayakOct 20, 2024
  37. 2/6 Documentation/git-update-ref.txt: remove safety paragraphskristofferhaugsbakk@fastmail.com, Oct 19, 2024
  38. karthik nayakOct 20, 2024
  39. Kristoffer HaugsbakkOct 20, 2024
  40. Kristoffer HaugsbakkOct 20, 2024
  41. 3/6 Documentation/git-update-ref.txt: demote symlink to last sectionkristofferhaugsbakk@fastmail.com, Oct 19, 2024
  42. 4/6 Documentation/git-update-ref.txt: remove confusing paragraphkristofferhaugsbakk@fastmail.com, Oct 19, 2024
  43. 5/6 Documentation/git-update-ref.txt: discuss symbolic refskristofferhaugsbakk@fastmail.com, Oct 19, 2024
  44. 6/6 Documentation: mutually link update-ref and symbolic-refkristofferhaugsbakk@fastmail.com, Oct 19, 2024
  45. karthik nayakOct 20, 2024
  46. 0/6 doc: update-ref: amend old material and discuss symrefskristofferhaugsbakk@fastmail.com, Oct 21, 2024
  47. 1/6 Documentation/git-update-ref.txt: drop “flag”kristofferhaugsbakk@fastmail.com, Oct 21, 2024
  48. 2/6 Documentation/git-update-ref.txt: remove safety paragraphskristofferhaugsbakk@fastmail.com, Oct 21, 2024
  49. 3/6 Documentation/git-update-ref.txt: demote symlink to last sectionkristofferhaugsbakk@fastmail.com, Oct 21, 2024
  50. 4/6 Documentation/git-update-ref.txt: remove confusing paragraphkristofferhaugsbakk@fastmail.com, Oct 21, 2024
  51. 5/6 Documentation/git-update-ref.txt: discuss symbolic refskristofferhaugsbakk@fastmail.com, Oct 21, 2024
  52. 6/6 Documentation: mutually link update-ref and symbolic-refkristofferhaugsbakk@fastmail.com, Oct 21, 2024
  53. Taylor BlauOct 21, 2024
  54. Andreas SchwabOct 12, 2024

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.