main branches locally
main branches locally
Posted Oct 23, 2025 19:16 UTC (Thu) by josh (subscriber, #17465)In reply to: main branches locally by Wol
Parent article: Git considers SHA-256, Rust, LLMs, and more
I want to get rid of a years-out-of-date useless snapshot of the upstream repo, complete with rendered ancient README.
(That's leaving aside occasional annoying UI issues with local git when it starts thinking the local `main` branch should follow fork/main rather than origin/main.)
> For which you need the main branch to exist. Otherwise, when upstream actions the pull request, how does it know what exactly to pull?
That isn't how forges like github typically work. A pull request is sent from a feature branch to the upstream main branch, and the relevant thing is what changes are in that feature branch that aren't in *upstream's* main. The main branch of the fork plays no part in that whatsoever.
> Bear in mind your repository is [snip explanation of how git repositories and parent commits work]
I'm aware, and I'm certainly not suggesting all the parent commits should go away; that would not be compatible with how git works. I'm saying a fork that exists to host feature branches has no reason to have a main branch.
> If you mean that file, your branch suddenly becomes the entire repository because you know longer have any way of knowing what exactly exists on your system and what exists upstream.
The difference between my feature branch and upstream is represented via the changes present in `fork/myfeaturebranch` that aren't present in `origin/main`; that's what the PR will show as the commits it contains, and that's what upstream will end up reviewing. `fork/main` plays no part in that comparison, and is *always* useless noise (and useless noise that has a rendered stale README, etc).
