#!/bin/bash # Get the current branch name current_branch=$(git rev-parse --abbrev-ref HEAD) # Check if the current branch is master if [[ "$current_branch" == "master" ]]; then read -p "You are about to commit to the master branch. Do you want to continue? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Commit aborted." exit 1 fi fi