Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent accidental commit to master #146

Closed
plastikfan opened this issue Mar 15, 2023 · 3 comments · Fixed by #148
Closed

prevent accidental commit to master #146

plastikfan opened this issue Mar 15, 2023 · 3 comments · Fixed by #148
Assignees
Labels
chore Non source related, infrasture change

Comments

@plastikfan
Copy link
Contributor

plastikfan commented Mar 15, 2023

See:

To undo the last commit (ref) : git reset HEAD~

@plastikfan plastikfan added the chore Non source related, infrasture change label Mar 15, 2023
@plastikfan plastikfan self-assigned this Mar 15, 2023
@plastikfan
Copy link
Contributor Author

plastikfan commented Mar 15, 2023

  • $ sudo apt install python3-pip
  • $ pip install pre-commit
  • $ then add .pre-commit-config.yaml wth content:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.2.0
    hooks:
      - id: no-commit-to-branch
        args: ["--branch", "master", "--branch", "main"]
  • then install the pre commit hooks:
    $ pre-commit install
  • then update to the latest version
    $ pre-commit autoupdate

@plastikfan plastikfan pinned this issue Mar 15, 2023
@plastikfan
Copy link
Contributor Author

when this change check in:

 plastikfan@Janus  ~/dev/github/go/snivilised/extendio λ   chore/prevent-commit-to-master ✚  git commit -m "chore(config): add no-commit-to-branch hook (#146)"
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
don't commit to branch...................................................Passed
[chore/prevent-commit-to-master f3db10f] chore(config): add no-commit-to-branch hook (#146)
 1 file changed, 6 insertions(+)
 create mode 100644 .pre-commit-config.yaml
 plastikfan@Janus  ~/dev/github/go/snivilised/extendio λ   chore/prevent-commit-to-master

@plastikfan
Copy link
Contributor Author

This might have been installed but mistakenly not activated. Regardless, the commit hook is not activated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Non source related, infrasture change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant