qnngroup / qnngds

MIT License
4 stars 3 forks source link

Add pre-commit hook to prevent accidentally committing to master #34

Closed reed-foster closed 4 months ago

reed-foster commented 5 months ago

Something like this:

- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: v4.5.0
  hooks:
    - id: no-commit-to-branch
      args: ['--branch', 'main']
    - id: check-added-large-files
    - id: check-merge-conflict
audrey01mit commented 5 months ago

Whatever you commit to master won't be authorized to be pushed without PR so I don't really see the use of it. Maybe I am missing something?

reed-foster commented 5 months ago

Yeah, the branch protection will prevent you from pushing local changes. This would just be in addition to that, so you can't end up with local changes to master in the first place. That way you can't accidentally commit to your local copy of master and then have to do a soft reset to roll back the commit.