|
|
Log in / Subscribe / Register

main branches locally

main branches locally

Posted Oct 24, 2025 23:26 UTC (Fri) by intgr (subscriber, #39733)
In reply to: main branches locally by mathstuf
Parent article: Git considers SHA-256, Rust, LLMs, and more

> I agree that it is annoying that [main branch] is not (often) synchronized

But why spend the compute resources updating the branch if users don't need or use it? Even if it were periodically updated, that would just create the illusion of an up to date branch. When I rebase, I want the latest origin/main, not "a few hours out of sync" one.

I might only use the fork for one pull request and never thereafter. Why even waste the disk space if there are no remaining feature branches?

As for "baseline state" of the fork: that's just the common ancestor of upstream repo and any particular feature branch.

I had never thought about these things but everything that gioele and Josh here said is a revelation about why git and the forges based on it feel so clunky to interact with.


to post comments

main branches locally

Posted Oct 25, 2025 2:01 UTC (Sat) by mathstuf (subscriber, #69389) [Link] (1 responses)

> When I rebase, I want the latest origin/main, not "a few hours out of sync" one.

That's fine; why is your local `main` tracking your fork's `main` if you're not keep it up-to-date?

> I might only use the fork for one pull request and never thereafter. Why even waste the disk space if there are no remaining feature branches?

Forks live in the same repository as the main one. They are segregated using git namespaces (see `gitnamespaces(7)`) so that each access uses a different ref namespace and cannot "see" each other. This is the root cause of that issue where one could push a commit to a fork and then rewrite the URL to be that of the main repository and it would render your content under upstream's URL. I believe there is now a banner when this is done to show that the content is not actually "in" the repository being viewed when the object/tree/commit is not actually reachable from the project's ref namespace.

There was slight reference to this in it being "20 bytes on disk" elsewhere in this thread, but even that might be wrong (besides ref files being 40 bytes due to their ASCII representation) because I believe forges now use `reftable` to store refs in a single file (sqlite db?) rather than a file-per-ref due to filesystem overhead with that mechanism. The vast majority of the cost of a fork is in the database presence it takes up, not the git repository itself.

The shared-repository-with-namespaced-refs is also why I think some namespace-hopping symref to just make a fork's `main` *be* upstream's `main` would be an ideal solution here.

main branches locally

Posted Oct 25, 2025 3:03 UTC (Sat) by josh (subscriber, #17465) [Link]

> Forks live in the same repository as the main one. They are segregated using git namespaces (see `gitnamespaces(7)`) so that each access uses a different ref namespace and cannot "see" each other.

14 years ago, a friend and I wrote the first version of the git namespaces support. :)

This is very much what I had in mind when saying that there's no fundamental reason a fork "needs" a main branch, or a distinct main branch, in order to be tied to the original repository.

> I had never thought about these things but everything that gioele and Josh here said is a revelation about why git and the forges based on it feel so clunky to interact with.

❤️


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds