gitconfig-man
v1.0.2
Published
A cli tool to manage multiple git config profiles and switch between different git configurations with ease & grace.
Maintainers
Readme
gitconfig-man

A sophisticated CLI tool to manage multiple git config profiles and switch between different git configurations with ease & grace.
CI/CD Status
| Workflow | Status |
|----------|--------|
| Build & Test | |
| Test Coverage |
|
| NPM Publish |
|
Platform Support
Tests run automatically on:
- ✅ Ubuntu (Linux) - Node.js 16.x, 18.x, 20.x
- ✅ macOS - Node.js 16.x, 18.x, 20.x
- ✅ Windows - Node.js 16.x, 18.x, 20.x
19 Tests | 19%+ Coverage | All Tests Passing
Overview
Managing different git configurations for different projects or accounts can be tedious. This package makes your life easier by creating different git config profiles and managing them for you. Perfect for developers who need to switch between personal and work accounts, or manage multiple git identities.
Installation
npm install -g gitconfig-manUsage
➜ ~ gitconfig-man -h
Git Config Man - Git Config Profile Manager
Usage: gitconfig-man <command> [options]
Commands:
-i Initialize gitconfig-man and create default profile
-c [name] Create new git config profile (interactive if no name)
-s [name] Switch to another git config profile (interactive if no name)
-d [name] Delete git config profile (interactive if no name)
-ls List all profiles
-h Show help
-v Show version
Tip: Run commands without arguments for interactive mode✨ Interactive Features
gitconfig-man supports interactive mode with autocomplete! Simply run commands without arguments to get an enhanced interactive experience:
gitconfig-man -s- Interactive profile switcher with autocompletegitconfig-man -c- Interactive profile creator with validationgitconfig-man -d- Interactive profile deletion with confirmation
Initialization
Calling gitconfig-man -i creates a ~/.gitconfigman/ directory if it doesn't exist, and saves your current global git config as the 'default' profile.
➜ ~ gitconfig-man -i
⚙️ Initializing Git Config Man...
✓ Created gitconfig-man directory: /Users/username/.gitconfigman
✓ Created default profile
✓ Activated 'default' profile
✨ Git Config Man initialized successfully!Create a new git config profile
With profile name:
➜ ~ gitconfig-man -c work
✓ Saved current git config to 'default' profile
✓ Created new profile: work
? Do you want to switch to newly created profile (work)? (Y/n) y
✓ Activated profile 'work'
Current git config has been cleared. Configure it using 'git config --global' commands.Interactive mode (just run without name):
➜ ~ gitconfig-man -c
? Enter name for the new profile: personal
✓ Saved current git config to 'default' profile
✓ Created new profile: personal
? Do you want to switch to newly created profile (personal)? (Y/n) After creating a new profile and switching to it, your global git config will be cleared. You can then configure it using standard git commands:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global core.editor "vim"
# ... any other git config settings you needList available git config profiles
➜ ~ gitconfig-man -ls
Available profiles:
• default
✓ work (active)
• personalSwitch to a specific git config profile
With profile name:
➜ ~ gitconfig-man -s default
✓ Saved current git config to 'work' profile
✓ Activated profile 'default'Interactive mode with autocomplete (just run without name):
➜ ~ gitconfig-man -s
? Select profile to switch to: (Use arrow keys or type to search)
❯ default
personalStart typing to filter profiles with autocomplete!
Delete a specific git config profile
With profile name:
➜ ~ gitconfig-man -d work
✓ Successfully deleted profile 'work'Interactive mode with autocomplete and confirmation (just run without name):
➜ ~ gitconfig-man -d
? Select profile to delete: (Use arrow keys or type to search)
❯ work
staging
? Are you sure you want to delete profile 'work'? (y/N) y
✓ Successfully deleted profile 'work'Get the current gitconfig-man version
➜ ~ gitconfig-man -v
gitconfig-man version 1.0.0How It Works
gitconfig-man works by:
- Storing your git global configurations as JSON files in
~/.gitconfigman/ - Each profile is saved as
profilename.json - When you switch profiles, it:
- Saves your current git config to the active profile
- Clears all global git config settings
- Applies the settings from the new profile
This means all your git config --global settings are preserved and can be switched instantly!
Common Use Cases
Personal and Work Accounts
# Initialize
gitconfig-man -i
# Create work profile
gitconfig-man -c work
git config --global user.name "Work Name"
git config --global user.email "[email protected]"
# Create personal profile
gitconfig-man -c personal
git config --global user.name "Personal Name"
git config --global user.email "[email protected]"
# Switch between them
gitconfig-man -s work
gitconfig-man -s personalDifferent Project Configurations
# Profile for open source projects
gitconfig-man -c opensource
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global core.editor "vim"
# Profile for client projects
gitconfig-man -c client
git config --global user.name "Professional Name"
git config --global user.email "[email protected]"
git config --global core.editor "nano"Requirements
- Node.js >= 16.0.0
- npm >= 7.0.0
- Git installed and accessible via command line
Development
Running Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:ciProject Structure
gitconfig-man/
├── src/
│ ├── __tests__/ # Test files
│ ├── cli.js # CLI entry point
│ ├── cliOptions.js # CLI argument parsing
│ ├── commands.js # Command implementations
│ ├── constants.js # Constants and configuration
│ └── extendConfig.js # Git config utilities
├── .github/
│ └── workflows/ # GitHub Actions CI/CD
├── index.js # Main entry point
└── package.jsonContributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
ISC, a permissive free software license published by the Internet Software Consortium.
Notes
- The 'default' profile cannot be deleted
- You cannot delete the currently active profile
- All git config changes are saved automatically when switching profiles
- Profile files are stored in
~/.gitconfigman/directory
Contact
- GitHub (shahidullahkhankhattak)
- Email ([email protected])
Made with ❤️ for developers who manage multiple git identities by Shahid Ullah Khan from Pakistan.
