A simple bash script to fetch or pull one or more git repositories at a specified location on your system. Perfect for keeping multiple projects up-to-date with a single command.
Table of Contents
- Bulk repository management: Automatically discover and update multiple git repositories in a directory
- Flexible update modes: Choose between
git pull
(merge changes) andgit fetch
(download only) - Smart repository detection: Recursively find all
.git
directories with configurable depth - Safe preview mode: Dry-run option to see what actions would be performed before executing
- Robust error handling: Continues processing other repositories even if one fails
- Cross-platform compatibility: Works on Linux, macOS, and other Unix-like systems
- Zero dependencies: Pure bash script with no external requirements beyond git
- Bash (v4+ recommended)
- Git (v2+ recommended)
You can run Mass Git immediately in your current directory or install it globally for convenience:
Download and run the script in your current directory:
curl -O https://raw.githubusercontent.com/StrangeRanger/mass-git/refs/heads/main/mass-git
chmod +x mass-git
./mass-git
To use Mass Git from anywhere, install it to your local bin directory:
git clone https://github.com/StrangeRanger/mass-git
cd mass-git
./setup.bash
Next, verify that the script is executable and available in your PATH:
mass-git -v
# Should output something like: Mass Git v2.0.2
Note
By default, setup.bash
creates a hard link in ~/.local/bin
. To use a symbolic link instead, set C_USE_HARD_LINK=false
in the script.
❯ mass-git -h
Fetch or pull one or more git repositories at a specified location on your
system.
Usage: mass-git [-r] [-f] [-d] <path>
mass-git -h
mass-git -v
Options:
-h, --help : Displays this help message.
-r, --recursive : Recursively locate git repositories.
-f, --fetch : Fetch instead of pull from git repository.
-d, --dry-run : Show what would be done, without making any changes.
-v, --version : Display program version number.
To remove the script, simply delete the mass-git
file from your system. If you used setup.bash
, remove the link from ~/.local/bin
:
rm ~/.local/bin/mass-git
If you cloned the repository, you can also delete the mass-git
directory:
rm -rf <path_to_mass_git_directory>
This program should work on all Unix and Unix-like operating systems that have bash installed, including:
- Linux
- macOS
- BSD variants
- Windows Subsystem for Linux (WSL)
Q: I get a 'Permission denied' error when running the script.
A: Make sure the script is executable:
chmod +x mass-git
.
Q: The script is not found after running setup.
A: Ensure
~/.local/bin
is in your$PATH
. You can add it to your shell resource file:# For bash users: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc # For zsh users: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
Q: Does this work on Windows?
A: Not natively, but it should work in WSL or other Unix-like environments.
Q: How does the script handle authentication?
A: The script uses your existing git configuration and SSH keys.
Q: What happens if a repository has uncommitted changes?
A: The script will attempt to pull/fetch as normal. Git's built-in safety features will prevent data loss, but you may see warnings about uncommitted changes.
For questions, suggestions, or bug reports, please open an issue on GitHub.
This project is licensed under the MIT License.