Menu

Tree [29d88d] main /
 History

HTTPS access


File Date Author Commit
 .gitattributes 2026-01-10 Pat Trainor Pat Trainor [287976] Auto commit (git_push_auto.git:main): +1 ~0 -0
 README.md 2026-01-19 Pat Trainor Pat Trainor [29d88d] Auto commit (git_push_auto.git:main): +0 ~1 -0
 git-push-auto.sh 2026-01-19 Pat Trainor Pat Trainor [62feb5] Auto commit (git_push_auto.git:main): +0 ~1 -0

Read Me

git-push-auto

An automated Git commit and push helper utility that processes one or many repositories, detects changes, creates descriptive commit messages, and automatically pushes to remote repositories. Perfect for managing multiple projects in a workspace.

Description

git-push-auto is a lightweight bash script designed to streamline the Git workflow by automatically staging all changes, generating detailed commit messages, and pushing to remote repositories. It supports processing multiple git projects using glob patterns, making it perfect for developers managing multiple repositories in a workspace folder. Ideal for continuous integration scenarios, automated backups, or any workflow where you need standardized, descriptive commit messages without manual intervention.

Features

  • Multiple Project Support: Process one or many git repositories in a single command using glob patterns
  • Automatic Change Detection: Stages all changes (respecting .gitignore rules)
  • Smart Commit Messages: Generates detailed multi-line commit messages containing:
  • Summary line with change statistics (added, modified, deleted files)
  • File-by-file breakdown of all changes
  • Support for renames, copies, and all Git change types
  • Progress Tracking: Shows "Processing X of Y" progress when working with multiple projects
  • Helpful Summary: Reports how many projects were committed, skipped, or failed
  • Automatic Push: Commits and pushes changes to the remote repository in one operation
  • Smart Filtering: Automatically skips non-git directories
  • Multi-platform Support: Works on Unix/Linux and Windows (via MINGW64/Git Bash)

Requirements

  • Bash shell (POSIX-compliant)
  • Git command-line tools
  • Standard Unix utilities (mktemp, basename, printf)

Installation

  1. Clone this repository:
git clone ssh://theitguys@git.code.sf.net/p/git-push-auto/code git-push-auto
cd git-push-auto
  1. Make the script executable (if not already):
chmod +x git-push-auto.sh
  1. Optionally, add to your PATH for system-wide access:
sudo cp git-push-auto.sh /usr/local/bin/git-push-auto

Usage

./git-push-auto.sh <path-or-pattern> [path-or-pattern...]

Arguments

  • path-or-pattern - Path to a git repository or glob pattern matching multiple directories
  • Multiple paths/patterns can be specified

Examples

Single Project

./git-push-auto.sh ~/projects/my-website

All Projects in Current Directory

./git-push-auto.sh ./*

This processes all subdirectories that are git repositories, skipping non-git folders.

All Projects in a Workspace

./git-push-auto.sh /path/to/workspace/*

Projects Matching a Pattern

./git-push-auto.sh ./SRC*

Processes all directories starting with "SRC" (like SRC_project1, SRC_project2, etc.)

Multiple Specific Projects

./git-push-auto.sh ./project1 ./project2 ./project3

Output Example

When processing multiple projects:

Found 3 git repositories to process

========================================
Processing 1 of 3: my-website
========================================
  Repository : my-website
  Branch     : main
  Changes    : +3 ~2 -1
  Pushing to origin/main ...
  ✓ Done

========================================
Processing 2 of 3: my-api
========================================
  ✓ No changes to commit in my-api

========================================
Processing 3 of 3: my-docs
========================================
  Repository : my-docs
  Branch     : main
  Changes    : +1 ~0 -0
  Pushing to origin/main ...
  ✓ Done

========================================
Summary:
  Total repositories: 3
  ✓ Committed & pushed: 2

  - Skipped (no changes): 1
========================================

How It Works

  1. Directory Discovery: Expands glob patterns and collects all directories
  2. Git Validation: Filters for directories that are valid Git repositories
  3. Progress Tracking: Shows "Processing X of Y" for each repository
  4. Per-Repository Processing:
  5. Stages all changes with git add -A (respecting .gitignore)
  6. Examines staged changes and categorizes by type (Added, Modified, Deleted, Renamed, Copied)
  7. Generates descriptive commit message with statistics and file listings
  8. Commits the staged changes
  9. Pushes to the remote repository on the current branch
  10. Summary Report: Shows total repositories processed, committed, skipped, and failed

Commit Message Format

The generated commit messages follow this format:

Auto commit (repository-name:branch): +added ~modified -deleted [Rrenamed] [Ccopied]

[Detailed breakdown of files by change type]

Commit Message Examples

Auto commit (git_push_auto.git:main): +1 ~1 -0

Details:

Added (1):

- README.md

Modified (1):

- git-push-auto.sh

Symbol Legend

  • + (plus) = Added files (new files)
  • ~ (tilde) = Modified/Edited files (changes to existing files)
  • - (minus) = Deleted files (removed files)
  • r = Renamed files (optional, only shown if present)
  • c = Copied files (optional, only shown if present)

Examples

  • +1 ~1 -0 = 1 new file added, 1 file modified, 0 files deleted
  • +3 ~2 -1 = 3 added, 2 modified, 1 deleted
  • +0 ~5 -0 r2 = 0 added, 5 modified, 0 deleted, 2 renamed
  • +3 ~2 -1 r1 c2 = 3 added, 2 modified, 1 deleted, 1 renamed, 2 copied

Use Cases

  • Multi-Project Workspaces: Commit and push all your active projects at end-of-day with one command
  • Automated Backups: Schedule regular commits across multiple repositories
  • CI/CD Pipelines: Auto-commit generated files or build artifacts across services
  • Rapid Development: Quick commits during prototyping without manual message writing
  • Monitoring Systems: Track changes to monitored files automatically
  • Synchronization: Keep multiple repositories in sync with automatic pushes
  • Pattern-Based Processing: Process all client projects, all microservices, or any pattern-matched set

Author

Pat Trainor (Pat@ITGuys.Business)

Repository

Hosted on SourceForge: ssh://theitguys@git.code.sf.net/p/git-push-auto/code

License

Please check with the repository owner for licensing information.