Hi Peff & Ævar,
On Tue, 16 Jun 2020, Jeff King wrote:
On Tue, Jun 16, 2020 at 10:09:32AM -0400, Jeff King wrote:
quoted
I think with that, we could ditch core.mainBranch entirely, with no
notion at all of "this branch is special in this repo". We use HEAD
where appropriate, and otherwise avoid any specialness.
One obvious exception is that third-party tools may want to know the
"special" branch for some reason. But I'm inclined to say that they
should (in this order):
- consider whether they really need a special branch at all, or if the
mechanism can be made more generic
- consider whether HEAD is the best value for a special branch (e.g.,
GitHub pull requests default to targeting HEAD)
Indeed, this is applicable in many circumstances. For example, instead of
https://github.com/git/git/blob/master/README.md it is just as easy (and
more robust) to write https://github.com/git/git/blob/HEAD/README.md.
The same goes for `git ls-remote origin HEAD` and as a consequence, `git
fetch origin HEAD`: it fetches the default branch of the remote
repository.
And with that, I could imagine that this is not actually necessary:
- rely on per-tool config for what's special (because it really may
vary between tools, and that's more flexible anyway)
But I'm open to hearing about cases where some tool really wants to know
"what did the user consider the special branch at the time of creation".
I cannot think of any use cases, apart from essentially creating a new
repository, where a tool or a user would want to know of such a
preference.
Ciao,
Dscho