Git Fetch All (gfa) is a command-line tool that automatically discovers and manages all Git repositories within the current directory. It provides a comprehensive overview of repository states and performs batch operations like fetching and pulling across multiple repositories simultaneously.
gfa scans the current directory for Git repositories and performs the following operations on each:
- Discovery: Identifies all subdirectories containing Git repositories (
.gitfolders) - Status Check: Determines if the working directory is clean or has uncommitted changes
- Branch Information: Shows the current branch for each repository
- Remote Tracking: Displays the relationship with remote branches (up-to-date, behind, etc.)
- Batch Operations: Automatically fetches from all remotes and pulls when safe to do so
- Visual Feedback: Presents results in a color-coded table format
The tool operates in several phases:
- Scanning Phase: Recursively scans the current directory for subdirectories containing
.gitfolders - Parallel Processing: Processes all discovered repositories concurrently for optimal performance
- Git Operations: For each repository:
- Checks if it's a valid Git repository
- Retrieves current branch information
- Checks working directory status (clean/dirty)
- Fetches from all remotes with pruning
- Determines if the local branch is behind the remote
- Automatically pulls if the working directory is clean and updates are available
- Real-time Display: Updates the terminal display in real-time as operations complete
gfa uses the following Git commands and defaults:
-
Fetch Command:
git fetch --all --tags --prune --prune-tags --quiet--all: Fetches from all configured remotes--tags: Fetches all tags--prune: Removes remote-tracking branches that no longer exist on the remote--prune-tags: Removes local tags that no longer exist on the remote--quiet: Suppresses verbose output
-
Status Check:
git status --porcelain- Uses porcelain format for consistent, script-friendly output
-
Branch Information:
git branch --show-currentandgit branch -vv- Shows current branch and verbose branch information with tracking details
-
Pull Behavior: Only pulls when:
- Working directory is clean (no uncommitted changes)
- Local branch is behind the remote branch
- Uses default
git pull(typically fast-forward merge)
- Git: Must be installed and available in PATH
- Node.js: Runtime environment (bundled in standalone executable)
gfaShow the CLI version:
gfa --version
# or
gfa -v- q: Quit the application
- Ctrl+C: Force quit
- Escape: Quit the application
The tool displays a table with the following columns:
- DIRECTORY: Repository directory name
- BRANCH: Current Git branch
- STATUS: Working directory status (clean/dirty/no git/error)
- REMOTE: Remote tracking status (up-to-date/behind/no remote/etc.)
- ACTION: Last performed action (fetched/pulled/error details)
- Green: Success states (clean status, up-to-date, successful operations)
- Yellow: Warning states (dirty working directory, behind remote, no remotes)
- Red: Error states (Git errors, repository issues)
- Cyan: Headers and directory names
- White: Default text
- TypeScript: Primary programming language for type safety and developer experience
- React: UI framework for building the terminal interface
- Ink: React renderer for CLI applications, enabling component-based terminal UIs
- Node.js: JavaScript runtime environment
- esbuild: JavaScript/TypeScript bundler used for:
- Building the production bundle
- Creating a single executable file
- Targeting the Node.js runtime
- ESLint: Code linting with TypeScript support
- Prettier: Code formatting
- tsx: TypeScript execution for development
- npm-run-all: Script orchestration for build processes
- Compilation: esbuild bundles the TypeScript source into a single JavaScript file
- Executable Creation: The bundle includes a shebang (
#!/usr/bin/env node) and Node ESM compatibility glue so it can run as a CLI - Distribution: The resulting binary can be copied to any location in PATH
- Component-Based: Uses React components for UI structure
- Async/Parallel Processing: Leverages Promise.all for concurrent repository processing
- Real-time Updates: State management enables live updates as operations complete
- Error Handling: Comprehensive error handling with user-friendly error messages
gfa is a TypeScript application that compiles to a standalone Node.js executable. The build process uses esbuild to produce a bundled CLI for Node.js.
# Run in development mode
npm run dev
# Build production executable
npm run build
# Run linting
npm run lint
# Format code
npm run lint:formatfix- Handle terminal height constraints for large repository lists
- Add comprehensive test suite
- Add configuration file support for custom Git commands
- Support for custom directory scanning depth