Re:In a Git repository, where do your files live?
by WorldMaker on Friday September 15, 2023 @01:18AM
(#37518764)
Also, many repo hosts have branch protection tools, and VS Code has a setting git.branchProtection to list branches which you want VS Code to remind you not to commit to, which can be handy.
https://stackoverflow.com/questions/40462111/prevent-commits...
Alternately, you can simply not check out that branch locally at all, and then you'll never have to worry about accidentally committing to it.