Skip to content

prevent commiting to default main branch in local repo #25

Description

@somombo

add the following pre-commit hook

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "main" ]; then
  echo "Dev Branch commit is blocked"
  exit 1
fi

if [ "$branch" = "master" ]; then
  echo "Master Branch commit is blocked"
  exit 1
fi

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions