News for hackers. Stuff that matters.
Re:In a Git repository, where do your files live? by djur on Thursday September 14, 2023 @10:44PM (#37517635)
The logic you're suggesting can easily be implemented with a Git hook:

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.

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.