Skip to content

Instantly share code, notes, and snippets.

View zubaer-ahammed's full-sized avatar
🏠
Working from home

Md. Zubaer Ahammed zubaer-ahammed

🏠
Working from home
View GitHub Profile
@zubaer-ahammed
zubaer-ahammed / Git Pre-Commit Hook for Protecting Master, Main and Production Branches.md
Last active February 6, 2025 10:51
Git Pre-Commit Hook for Protecting Master, Main and Production Branches

🚀 Git Pre-Commit Hook for Protecting Master & Main Branches

A Git pre-commit hook that prevents accidental commits on protected branches (master, main, production).

🔥 Features

🔴 Warning when committing on a protected branch.
🟢 Option to proceed (yes) or discard uncommitted changes (discard).
🟡 Default is no (commit aborted unless explicitly confirmed).
📜 Logs commit attempts in ~/.git_commit_log.txt for auditing.
🎨 Color-coded output for better readability.

@zubaer-ahammed
zubaer-ahammed / Create Tag on a Branch (with branch name input, automatic tag name, prompt to create pull request).md
Last active February 6, 2025 11:07
Create Tag on a Branch (with branch name input, automatic tag name, prompt to create pull request)

Steps to Create the Script

  1. Create the Script File Open your terminal and create a new script file:
nano ~/create_tag.sh
  1. Add the following content to the file:
  2. Save and close the file by pressing Ctrl + O, then Enter, and then Ctrl + X.