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

Re: feature request: set remote/HEAD with fetch

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 16, 2024, 22:10 UTC
Message-ID
<xmqqplq8jf02.fsf@gitster.g>
In-Reply-To
<Zr_KtAXQuFwEmFfI@tapette.crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 12 quoted lines
>> My current workaround is an alias:
>>     fetchall = !git fetch --all && git remote | xargs -i git remote set-head -a {}
>> 
>> which works for me, but I think it would be more elegant not to have to do this.
>
> I believe this would be a valuable change.  I know a lot of other users
> want this features as well.  However, I think it needs to be opt-in,
> since there are some cases where you want `git fetch` to specifically
> fetch only certain objects or don't want to modify the refs. For
> example, I know some server-side implementations use `git fetch`
> internally and require refs to be updated in a special way, and they
> would not appreciate extra refs appearing.

Yeah, "remote set-head" implementation internally uses the same "what's the current state of the refs on the other side?" query as what "fetch" does when it contacts the other side, so it makes sense for a new feature "git fetch --set-head ..." to internally do what is done by "remote set-head".

What should *not* happen automatically without an opt-in is to overwrite an existing refs/remotes/$remote/HEAD with a new value. It might even make sense to allow it to happen, even if the "--set-head" option is not given from the command line, if "refs/remotes/$remote/HEAD" does not exist.

Thanks.
Previous: brian m. carlsonNext: Jeff King
Message 3 of 7 in “feature request: set remote/HEAD with fetch”
  1. Bence FerdinandyAug 16, 2024
  2. brian m. carlsonAug 16, 2024
  3. Junio C HamanoAug 16, 2024
  4. Jeff KingAug 17, 2024
  5. Bence FerdinandyAug 17, 2024
  6. Johannes SchindelinAug 19, 2024
  7. Bence FerdinandyAug 20, 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.