Skip to content

Fetch or pull one or more git repositories at a specified location on your system.

License

Notifications You must be signed in to change notification settings

StrangeRanger/mass-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mass Git

Project Tracker Platform Style Guide Codacy Badge

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

Demo

asciicast

Features

  • Bulk repository management: Automatically discover and update multiple git repositories in a directory
  • Flexible update modes: Choose between git pull (merge changes) and git 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

Getting Started

Prerequisites

  • Bash (v4+ recommended)
  • Git (v2+ recommended)

Download and Setup

You can run Mass Git immediately in your current directory or install it globally for convenience:

1. Quick Start (Run Directly)

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

2. Install Globally (Recommended)

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.

Usage

❯ 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.

Uninstallation

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>

Supported Operating Systems

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)

Troubleshooting / FAQ

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.

Support

For questions, suggestions, or bug reports, please open an issue on GitHub.

License

This project is licensed under the MIT License.

About

Fetch or pull one or more git repositories at a specified location on your system.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages