Skip to content

Commit

Permalink
fix: check on commit to master, not main
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisvisser committed Dec 20, 2024
1 parent 6e8b953 commit f17084e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ log() {
log "Running custom pre-commit hook defined in ./husky/pre-commit"

# Prevent committing to "main"-branch:
if [ "$(git rev-parse --abbrev-ref HEAD)" = "main" ]; then
log "You shouldn't commit directly to the main branch."
if [ "$(git rev-parse --abbrev-ref HEAD)" = "master" ]; then
log "You shouldn't commit directly to the master branch."
log "Create a feature branch: git branch new-branch-name"
log "Then reset 'main': git reset --hard origin/main"
log "Then reset 'master': git reset --hard origin/master"
log "And continue to work: git checkout new-branch-name"
exit 1
fi
Expand Down

0 comments on commit f17084e

Please sign in to comment.