|
|
Subscribe / Log in / New account

main branches locally

main branches locally

Posted Oct 21, 2025 19:18 UTC (Tue) by josh (subscriber, #17465)
In reply to: master/main change by jhe
Parent article: Git considers SHA-256, Rust, LLMs, and more

I almost always wish my local repositories and my github forks could avoid having a local main branch at all. My workflow is that *every* change always happens on a branch, from which I create a pull request.

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).

The only time I ever want a local main branch is for the rare project where I commit directly to main, such as private one-person repositories.


to post comments

main branches locally

Posted Oct 21, 2025 21:15 UTC (Tue) by iabervon (subscriber, #722) [Link]

In your local repositories, you can just checkout origin/main and then branch -d main. It's a hassle that it creates it, but you don't need to keep it if you don't want to. (Alternatively, you can just use branch -m to turn it into the first local branch you want.)

main branches locally

Posted Oct 21, 2025 21:22 UTC (Tue) by myUser (subscriber, #58242) [Link]

> I almost always wish my local repositories and my github forks could avoid having a local main branch at all. My workflow is that *every* change always happens on a branch, from which I create a pull request.

Why then not just delete it? Yes it is created after cloning, but you can then just get rid of it for good.


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