| Crates.io | git-pair |
| lib.rs | git-pair |
| version | 0.3.0 |
| created_at | 2025-09-11 19:53:24.403359+00 |
| updated_at | 2025-09-11 19:53:24.403359+00 |
| description | A Git extension for managing pair programming sessions with per-branch co-author configuration |
| homepage | https://github.com/michaldarda/git-pair |
| repository | https://github.com/michaldarda/git-pair |
| max_upload_size | |
| id | 1834458 |
| size | 124,515 |
A Git extension for managing pair programming sessions. Easily configure Git to commit with multiple authors when pair programming.
git-pair helps teams that practice pair programming by simplifying the process of attributing commits to multiple authors. It provides a clean interface to manage co-authors and automatically formats commit messages with proper Co-authored-by trailers.
Install git-pair with a single command:
curl -sSf https://raw.githubusercontent.com/michaldarda/git-pair/master/install.sh | sh
Or with wget:
wget -qO- https://raw.githubusercontent.com/michaldarda/git-pair/master/install.sh | sh
This will:
~/.local/bin/git-pairgit clone https://github.com/michaldarda/git-pair.git
cd git-pair
cargo build --release
cp target/release/git-pair ~/.local/bin/
cargo install git-pair
curl -sSf https://raw.githubusercontent.com/michaldarda/git-pair/master/uninstall.sh | sh
git pair init
Initializes pair programming mode for the current branch. Each branch maintains its own co-author configuration, allowing different teams to work on different features simultaneously.
# Add co-authors directly
git pair add "Jane Doe" jane.doe@company.com
git pair add "John Smith" john.smith@company.com
# Or add from global roster using aliases
git pair add jane # Adds Jane Doe from global roster
git pair add john # Adds John Smith from global roster
Adds co-authors to the current branch's pair programming session. Co-authors are branch-specific, so switching branches will use different co-author configurations.
# Remove by name
git pair remove "Jane Doe"
# Remove by email
git pair remove jane.doe@company.com
# Remove by global alias
git pair remove jane
Removes specific co-authors from the current branch while keeping others. Supports flexible removal by name, email address, or global roster alias. The Git hook is automatically updated to reflect the changes, or removed entirely if no co-authors remain.
git pair clear
Removes all co-authors from the current branch and exits pair programming mode for this branch, returning to solo development. Other branches maintain their own co-author configurations.
git pair status
Displays the currently configured co-authors and pair programming status.
git pair --help # Show comprehensive help
git pair --version # Show version information
git-pair uses per-branch configuration to manage co-authors. When you add co-authors using git pair add, the tool creates a branch-specific configuration file and installs a Git hook that automatically includes Co-authored-by trailers in your commit messages.
Each branch gets its own co-author configuration:
main branch β .git/git-pair/config-mainfeature/auth branch β .git/git-pair/config-feature_authbugfix/login branch β .git/git-pair/config-bugfix_loginWhen you switch branches, the Git hook automatically reads from the correct configuration file, ensuring the right co-authors are added to commits.
The Git hook runs on every commit and automatically appends co-authors to your commit messages. This follows GitHub's standard for attributing commits to multiple authors.
Example commit message with pair programming:
Implement user authentication feature
Co-authored-by: Jane Doe <jane.doe@company.com>
Co-authored-by: John Smith <john.smith@company.com>
git-pair stores its configuration in branch-specific files within .git/git-pair/ directory. This means:
Example configuration structure:
.git/git-pair/
βββ config-main # Co-authors for main branch
βββ config-feature_auth # Co-authors for feature/auth branch
βββ config-bugfix_login # Co-authors for bugfix/login branch
~/.config/git-pair/
βββ roster # Global roster of saved co-authors
The per-branch co-author system enables powerful workflows:
| Command | Description |
|---|---|
git pair init |
Initialize pair programming for current branch |
git pair add <name> <surname> <email> |
Add a co-author to the current branch |
git pair add <alias> |
Add co-author from global roster using alias |
git pair add --global <alias> <name> <email> |
Add a co-author to global roster |
git pair remove <name|email|alias> |
Remove a specific co-author from current branch |
git pair clear |
Remove all co-authors from current branch |
git pair status |
Show current branch's pair configuration |
git pair list --global |
Show global roster of saved co-authors |
git pair --version, -V |
Show version information |
git pair --help, -h |
Show help information |
| Variable | Description | Default |
|---|---|---|
GIT_PAIR_ROSTER_FILE |
Override global roster file location | ~/.config/git-pair/roster |
Example:
# Use custom roster file for testing or different environments
GIT_PAIR_ROSTER_FILE=/tmp/test-roster git pair add --global test "Test User" test@example.com
# Initialize pair programming for current branch
git pair init
# Add your pair programming partner
git pair add "Alice Johnson" alice@company.com
# Make commits as usual - they'll automatically include co-author attribution
git commit -m "Add new feature"
# Set up your global roster once
git pair add --global alice "Alice Johnson" alice@company.com
git pair add --global bob "Bob Wilson" bob@company.com
git pair add --global sarah "Sarah Chen" sarah@company.com
# View your roster
git pair list --global
# Output:
# Global roster:
# alice -> Alice Johnson <alice@company.com>
# bob -> Bob Wilson <bob@company.com>
# sarah -> Sarah Chen <sarah@company.com>
# Quick setup in any repository
git pair init
git pair add alice bob # Adds both Alice and Bob quickly!
# Make commits - co-authors automatically included
git commit -m "Implement new feature"
# On main branch - set up core team using global roster
git checkout main
git pair init
git pair add alice bob # Quick add from global roster
# Switch to feature branch - set up feature team
git checkout -b feature/authentication
git pair init
git pair add sarah # Add Sarah from global roster
git pair add "Carol Davis" carol@company.com # Add directly
# Commits on feature branch include Sarah and Carol
git commit -m "Implement login system"
# Switch back to main - automatically uses Alice and Bob
git checkout main
git commit -m "Update documentation"
# Each branch maintains its own co-author configuration!
# Add multiple co-authors for mob programming on current branch
git pair add bob carol dave # Mix of roster aliases and direct names
git pair add "Eve Foster" eve@company.com
# Check current branch's status
git pair status
# Remove specific team members as they leave the session
git pair remove dave # Remove by alias
git pair remove "Eve Foster" # Remove by name
# Continue working with remaining co-authors
git commit -m "Implement feature together"
# Start with initial team
git pair add alice bob
# Add someone who joins later
git pair add carol
# Remove someone who leaves early
git pair remove alice
# Continue with bob and carol
git commit -m "Complete feature implementation"
# Clear co-authors for current branch only
git pair clear
# Other branches keep their co-author configurations
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
git clone https://github.com/michaldarda/git-pair.git
cd git-pair
cargo build
cargo test
cargo test
For local development, use these handy scripts:
# Run all checks (formatting, linting, tests, integration tests)
./check.sh
# Apply automatic fixes (formatting, auto-fixable clippy suggestions)
./fix.sh
# Run integration tests only
./integration_test.sh
The check.sh script mirrors what the CI pipeline does and is perfect for ensuring your code is ready before committing.
Thank you to all the contributors who have helped make git-pair better:
This project is licensed under the MIT License - see the LICENSE file for details.
While there are existing solutions, git-pair aims to be:
Made with β€οΈ for pair programmers everywhere.