Overview
gh_submodule_sync is a simple shell script designed to automate the initialization and updating of Git submodules within a repository. It ensures that all submodules, including nested ones, are synchronized with their latest commits from their remote repositories.
Features
- Automatically checks for the presence of
.gitmodulesto confirm script is run from the repository root. - Initializes submodules if they are not already initialized.
- Updates all submodules recursively to the latest commits from their remote repositories.
- Provides clear success and error messages.
Tech Stack
- Shell scripting (Bash)
- Git (submodule management)
Getting Started
Prerequisites
- Git installed on your system.
- A cloned repository containing Git submodules.
Installation & Usage
- Save the script
gh_submodule_sync.shto your local machine or clone this repository. - Make the script executable:
chmod +x gh_submodule_sync.sh - Run the script from the root directory of your repository:
./gh_submodule_sync.sh
Project Structure
.
├── gh_submodule_sync.sh # Main shell script to sync submodules
├── README.md # This README file
└── index.md # Documentation in markdown format
Future Work / Roadmap
- Add support for configuring specific branches or tags for submodules.
- Implement logging to file for audit and troubleshooting.
- Add options for partial updates or selective submodule sync.
- Provide compatibility checks for different Git versions.
- Add support for Windows environments (PowerShell or batch script).
License
Assumed MIT License or as per repository owner.
For issues or contributions, please open a GitHub issue or pull request in this repository.