main branches locally
main branches locally
Posted Oct 23, 2025 21:00 UTC (Thu) by gioele (subscriber, #61675)In reply to: main branches locally by mathstuf
Parent article: Git considers SHA-256, Rust, LLMs, and more
Some forges even have an "update fork" button/API as well as ways to periodically fetch updates the the HEAD-pointed branch.
I'd love if git-the-command-line-tool could also finally get a clue about this paradigm.
I'd like to be able to do something like `git clone $MYFORK-REPO-ON-A-FORGE --real-upstream $UPSTREAM-REPO` and have git taking care of:
1) correctly setting the remote from which branches should be pushed and pulled (`main` should be merged ff-only from $UPSTREAM-REPO, but pushed to $MYFORK-REPO-ON-A-FORGE),
2) ignore all branches of $UPSTREAM-REPO not pointed by HEAD (so, only fetch `main`),
3) prevent direct pushes to $UPSTREAM-REPO (I may have admin access to that repo, but our workflow is PR-based),
4) block commits to the `main` branch (all development should happen in feature branches).
I know that there are plenty of situations in which this kind of arrangement would not work, but it would cover the vast majority (95%+) of the projects and repos I deal with.
