Skip to content

Instantly share code, notes, and snippets.

View russom-woldezghi's full-sized avatar

Russom Woldezghi russom-woldezghi

View GitHub Profile
@stefansundin
stefansundin / install-pre-commit.sh
Last active November 15, 2024 10:49
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding: