From: "brian m. carlson" <sandals@crustytoothpaste•net>
To: Bence Ferdinandy <bence@ferdinandy•com>
Cc: git@vger•kernel.org
Subject: Re: feature request: set remote/HEAD with fetch
Date: Fri, 16 Aug 2024 21:55:00 +0000 [thread overview]
Message-ID: <Zr_KtAXQuFwEmFfI@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <D3HBD7C1FR14.74FL1Q1S9UCB@ferdinandy.com>
[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]
On 2024-08-16 at 11:53:31, Bence Ferdinandy wrote:
> Hi,
>
> this comes after a bit of discussion on #git. The current behaviour of git is
> that when cloning, `refs/remotes/[remote]/HEAD` is set, but if you use `git
> init` and `git remote add`, then you must manually run `git remote set-head -a`
> to arrive at the same state. Having origin/HEAD set is pretty useful for
> scripting and aliases, because you don't need to remember what the current
> project uses (origin/[master|main|trunk|etc]).
>
> I would propose that running `git fetch` should also update remote/HEAD. In
> case there is a possibility that it is useful in some cases that remote/HEAD is
> actually different from whatever is set in the remote repository as the default
> branch, I think a setting for opt-out would be better, and the default
> behaviour should be essentially always running `set-head -a`.
>
> 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.
--
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2024-08-16 21:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 11:53 feature request: set remote/HEAD with fetch Bence Ferdinandy
2024-08-16 21:55 ` brian m. carlson [this message]
2024-08-16 22:10 ` Junio C Hamano
2024-08-17 5:02 ` Jeff King
2024-08-17 19:00 ` Bence Ferdinandy
2024-08-19 16:40 ` Johannes Schindelin
2024-08-20 21:38 ` Bence Ferdinandy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zr_KtAXQuFwEmFfI@tapette.crustytoothpaste.net \
--to=sandals@crustytoothpaste$(echo .)net \
--cc=bence@ferdinandy$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox