Created
January 11, 2026 01:50
-
-
Save bivex/525f7961c63d0e338887618a4e9445f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Fast Git commit script | |
| # Creates new branch based on Unix timestamp | |
| # Stages all changes (including deletions) | |
| # Skips commit if nothing changed | |
| # Uses timestamped commit message | |
| set -e | |
| # Go to repo root (optional safety) | |
| REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || { | |
| echo "β Not inside a git repository" | |
| exit 1 | |
| } | |
| cd "$REPO_ROOT" | |
| # Create new branch with Unix timestamp | |
| BRANCH_NAME="branch_$(date +%s)" | |
| echo "π Creating and switching to new branch: $BRANCH_NAME" | |
| git checkout -b "$BRANCH_NAME" | |
| # Stage everything (add / modify / delete) | |
| git add -A | |
| # Check if there is anything to commit | |
| if git diff --cached --quiet; then | |
| echo "β Nothing to commit, working tree clean" | |
| exit 0 | |
| fi | |
| # Commit with timestamp | |
| COMMIT_MSG="fast commit on $BRANCH_NAME - $(date '+%Y-%m-%d %H:%M:%S')" | |
| git commit -m "$COMMIT_MSG" | |
| echo "β Commit created on branch $BRANCH_NAME: $COMMIT_MSG" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment