Skip to content

prevent commiting to default main branch in local repo #25

@somombo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions