main branches locally
main branches locally
Posted Oct 22, 2025 22:27 UTC (Wed) by gioele (subscriber, #61675)In reply to: main branches locally by josh
Parent article: Git considers SHA-256, Rust, LLMs, and more
>
> So, in a local repository, I always want every new branch to start from origin/main, not main, and I never want main to point to anywhere other than origin/main. And in a remote fork, main is nothing but a stale mirror of some ancient version of the base repo, because I never push to it except by mistake (creating a pull request from my main branch because I forgot to make a local branch, which is a pain).
I share your wish, but my concrete desire is that git would learn that "upstream repositories" are a special kind of repositories. Concretely, I'd like a simple way to tell git that:
1. Whenever I clone or fetch a certain remote (upstream), only a specific branch should be cloned/fetch (main). All other refs should be ignored.
2. A certain branch (main) should always be pulled from a certain remote (upstream) but always pushed to another one (myfork).
3. Even if I have r/w access to the upstream repository, it should never ever push any branch or tag to that repository.
