{"id":42427900,"url":"https://github.com/techquestsdev/git-context","last_synced_at":"2026-01-28T03:29:27.905Z","repository":{"id":323047160,"uuid":"1091920465","full_name":"techquestsdev/git-context","owner":"techquestsdev","description":"A powerful CLI tool for managing multiple Git configuration profiles","archived":false,"fork":false,"pushed_at":"2026-01-14T17:15:50.000Z","size":77,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-14T21:23:35.893Z","etag":null,"topics":["cli","configuration","developer-tools","git","go","identity-management","profiles"],"latest_commit_sha":null,"homepage":"https://TechQuests.dev/projects/git-context","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techquestsdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-07T18:05:11.000Z","updated_at":"2026-01-14T17:15:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/techquestsdev/git-context","commit_stats":null,"previous_names":["techquestsdev/git-context"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/techquestsdev/git-context","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techquestsdev%2Fgit-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techquestsdev%2Fgit-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techquestsdev%2Fgit-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techquestsdev%2Fgit-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techquestsdev","download_url":"https://codeload.github.com/techquestsdev/git-context/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techquestsdev%2Fgit-context/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28836690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T02:10:51.810Z","status":"ssl_error","status_checked_at":"2026-01-28T02:10:50.806Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","configuration","developer-tools","git","go","identity-management","profiles"],"created_at":"2026-01-28T03:29:27.308Z","updated_at":"2026-01-28T03:29:27.899Z","avatar_url":"https://github.com/techquestsdev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git Context Switcher\n\nA powerful command-line tool for managing multiple Git configuration profiles. Seamlessly switch between different Git identities (work, personal, school, etc.) with a single command.\n\n![Go Version](https://img.shields.io/github/go-mod/go-version/techquestsdev/git-context?logo=go\u0026logoColor=white)\n![Build Status](https://github.com/techquestsdev/git-context/workflows/CI/badge.svg)\n[![codecov](https://codecov.io/gh/techquestsdev/git-context/branch/main/graph/badge.svg)](https://codecov.io/gh/techquestsdev/git-context)\n![License](https://img.shields.io/github/license/techquestsdev/git-context)\n![Latest Release](https://img.shields.io/github/v/release/techquestsdev/git-context?include_prereleases)\n\n## Features\n\n- **Multiple Profiles** - Create and manage unlimited Git configuration profiles\n- **Instant Switching** - Switch between profiles with a single command\n- **Global Settings** - Define shared configuration across all profiles\n- **URL Rewrites** - Configure Git URL rewrites per profile (SSH \u003c-\u003e HTTPS)\n- **Safe Operations** - Automatic backups before switching profiles\n- **Interactive Setup** - Guided profile creation with prompts\n- **Colored Output** - Beautiful, easy-to-read CLI output\n- **YAML Configuration** - Simple, human-readable configuration format\n\n## Installation\n\n### Quick Install (Recommended)\n\n#### Using Go Install\n\n```bash\ngo install github.com/techquestsdev/git-context@latest\n```\n\nThen run with: `git-context`\n\n#### Using Homebrew (MacOS/Linux)\n\n```bash\nbrew tap techquestsdev/tap\nbrew install git-context\n```\n\n#### Download Binary\n\nDownload the latest release for your platform from the [Releases page](https://github.com/techquestsdev/git-context/releases):\n\n- **Linux** (amd64, arm64)\n- **MacOS** (Intel, Apple Silicon)\n- **Windows** (amd64)\n\n```bash\n# Example: Download and install on Linux/MacOS\ncurl -L https://github.com/techquestsdev/git-context/releases/latest/download/git-context_Linux_x86_64.tar.gz | tar xz\nsudo mv git-context /usr/local/bin/\n```\n\n### Build from Source\n\n#### Prerequisites\n\n- **Go** 1.25 or higher\n- **Git** 2.0 or higher\n- **Make** (optional, for using Makefile commands)\n\n#### Clone and Build\n\n```bash\n# Clone the repository\ngit clone https://github.com/techquestsdev/git-context.git\ncd git-context\n\n# Download dependencies\ngo mod download\n\n# Build the application\ngo build -o bin/git-context\n\n# Install to your system\nmake install\n# Or without Make:\ngo install\n\n# Verify installation\ngit-context --version\n```\n\n## Usage\n\n### Quick Start Guide\n\n#### 1. Initialize Configuration\n\nFirst-time setup:\n\n```bash\n# Initialize git-context\ngit-context init\n```\n\nThis creates `~/.config/git-context/config.yaml`.\n\n### Add Your First Profile\n\n```bash\n# Add a new profile named 'work'\ngit-context add work\n```\n\nYou'll be prompted for:\n\n- **Git Name** - Your full name\n- **Git Email** - Your email address\n- **GPG Signing Key** (optional) - Your GPG key ID\n- **URL rewrites** (optional) - SSH/HTTPS URL conversions\n\n#### 3. List All Profiles\n\n```bash\n# List available profiles\ngit-context list\n```\n\n**Output:**\n\n```text\n=== Available Profiles ===\n\nProfile      Email                         Status\n-------      -----                         ------\nwork         andre@work.com                ● (active)\npersonal     andre@personal.com\nuniversity   andre@university.edu\n```\n\n#### 4. Switch Between Profiles\n\n```bash\n# Switch to 'personal' profile\ngit-context switch personal\n\n# Switch back to the previous profile\ngit-context switch -\n```\n\n**Output:**\n\n```text\n=== Switching to Profile: personal ===\n\nℹ Backed up git config to /Users/andre/.gitconfig.bak\n✓ Switched to profile 'personal'\nℹ User: Andre Nogueira \u003candre@personal.com\u003e\n```\n\n#### 5. Show Current Profile\n\n```bash\n# Display the active profile\ngit-context current\n```\n\n#### 6. Show Profile Details\n\n```bash\n# Show details of 'work' profile\ngit-context show work\n```\n\n#### 7. Remove a Profile\n\n```bash\n# Remove 'university' profile\ngit-context remove university\n```\n\n### All Available Commands\n\n| Command                       | Description              |\n| ----------------------------- | ------------------------ |\n| `git-context init`            | Initialize configuration |\n| `git-context add \u003cname\u003e`      | Create a new profile     |\n| `git-context switch \u003cname\\|-\u003e`| Switch to a profile      |\n| `git-context list`            | List all profiles        |\n| `git-context current`         | Show active profile      |\n| `git-context show \u003cname\u003e`     | Show profile details     |\n| `git-context remove \u003cname\u003e`   | Delete a profile         |\n| `git-context --help`          | Show help                |\n| `git-context --version`       | Show version             |\n\n## Configuration\n\nThe configuration is stored in YAML format at `~/.config/git-context/config.yaml`.\n\n### Configuration Structure\n\n```yaml\nglobal:\n  # Shared settings across all profiles\n  \u003csection\u003e:\n    \u003ckey\u003e: \u003cvalue\u003e\n\nprofiles:\n  \u003cprofile-name\u003e:\n    user:\n      name: \"Your Name\"\n      email: \"your.email@example.com\"\n      signingkey: \"GPG_KEY_ID\" # optional\n    url:\n      - pattern: \"ssh://git@gitlab.com/\"\n        insteadOf: \"https://gitlab.com/\"\n    # Any other Git config sections...\n```\n\n### Example Configuration\n\n```yaml\nglobal:\n  core:\n    pager: delta\n    editor: nvim\n  push:\n    autoSetupRemote: true\n  merge:\n    conflictstyle: diff3\n  commit:\n    gpgsign: true\n  gpg:\n    program: /usr/local/bin/gpg\n  pull:\n    rebase: true\n\nprofiles:\n  work:\n    user:\n      name: \"Andre Nogueira\"\n      email: \"aanogueira@techquests.dev\"\n      signingkey: \"A0A90F4231D8B028\"\n    url:\n      - pattern: \"git@git.techquests.dev/\"\n        insteadOf: \"https://git.techquests.dev/\"\n      - pattern: \"ssh://git@github.com/\"\n        insteadOf: \"https://github.com/\"\n    http:\n      postBuffer: 157286400\n\n  personal:\n    user:\n      name: \"Andre Nogueira\"\n      email: \"aanogueira@protonmail.com\"\n      signingkey: \"B1C2D3E4F5G6H7I8\"\n    url:\n      - pattern: \"ssh://git@github.com/\"\n        insteadOf: \"https://github.com/\"\n\n  university:\n    user:\n      name: \"Andre Nogueira\"\n      email: \"aanogueira@university.edu\"\n      signingkey: \"C1D2E3F4G5H6I7J8\"\n```\n\n### Global vs Profile-Specific Settings\n\n- **Global settings** are applied to all profiles\n- **Profile-specific settings** override global settings\n- Any Git configuration section can be used (core, push, merge, etc.)\n\n### Common Configuration Sections\n\n| Section       | Purpose                       | Parameters             |\n| ------------- | ----------------------------- | ---------------------- |\n| `add`         | Add settings                  | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `alias`       | Create shortcuts for commands | \\\u003calias\\\u003e: \\\u003ccommand\\\u003e |\n| `branch`      | Branch management             | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `column`      | Column layout settings        | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `commit`      | Commit message templates      | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `core`        | Core Git settings             | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `custom`      | Custom settings               | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `delta`       | Delta pager settings          | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `diff`        | Diff settings                 | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `feature`     | Feature settings              | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `fetch`       | Fetch settings                | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `gpg`         | GPG settings                  | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `http`        | HTTP settings                 | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `init`        | Initialization settings       | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `interactive` | Interactive settings          | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `maintenance` | Maintenance settings          | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `merge`       | Merge settings                | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `pull`        | Pull settings                 | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `push`        | Push settings                 | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `rebase`      | Rebase settings               | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `rerere`      | Rerere settings               | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `pager`       | Pager settings                | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `tag`         | Tag settings                  | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `url`         | URL settings                  | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n| `user`        | User settings                 | \\\u003ckey\\\u003e: \\\u003cvalue\\\u003e     |\n\n## Use Cases\n\n### Scenario 1: Work vs Personal Repositories\n\nSeparate professional and personal Git identities:\n\n```bash\n# Create work profile with company email\ngit-context add work\n# Enter: Your Name, you@company.com, work-gpg-key\n\n# Create personal profile with personal email\ngit-context add personal\n# Enter: Your Name, you@personal.com, personal-gpg-key\n\n# Switch based on what you're working on\ngit-context switch work      # For company projects\ngit-context switch personal  # For personal projects\n```\n\n### Scenario 2: Multiple Companies/Clients\n\nManage identities for different employers or clients:\n\n```bash\ngit-context add client-a\ngit-context add client-b\ngit-context add freelance\n\n# Switch when changing projects\ngit-context switch client-a\n```\n\n### Scenario 3: Academic and Professional\n\nSeparate academic credentials from professional:\n\n```bash\ngit-context add university   # .edu email, academic GPG key\ngit-context add work         # Company email, work GPG key\n```\n\n### Scenario 4: Different URL Rewrites\n\nConfigure SSH access for different Git hosts:\n\n```yaml\nprofiles:\n  work:\n    url:\n      - pattern: \"ssh://git@git.company.com/\"\n        insteadOf: \"https://git.company.com/\"\n  personal:\n    url:\n      - pattern: \"ssh://git@github.com/\"\n        insteadOf: \"https://github.com/\"\n```\n\n## Safety Features\n\n- **Automatic Backups** - Before switching profiles, current Git config is backed up to `~/.gitconfig.bak`\n- **Confirmation Prompts** - Destructive operations require user confirmation\n- **Validation** - Profiles are validated before being applied\n- **Error Handling** - Clear error messages guide you when something goes wrong\n- **Non-Destructive Init** - `init` command preserves existing profiles\n\n## Troubleshooting\n\n### Config File Not Found\n\n**Solution:** Initialize the configuration:\n\n```bash\ngit-context init\n```\n\n### Profile Not Found\n\n**Solution:** Check available profiles:\n\n```bash\ngit-context list\n```\n\n### Git Config Not Updating\n\n**Problem:** No write permissions to `~/.gitconfig`\n\n**Solution:** Check file permissions:\n\n```bash\nls -la ~/.gitconfig\nchmod 644 ~/.gitconfig  # If needed\n```\n\n### Restore from Backup\n\nIf something went wrong, restore from the automatic backup:\n\n```bash\ncp ~/.gitconfig.bak ~/.gitconfig\n```\n\n### Profile Already Exists\n\n**Problem:** `git-context init` reports profiles exist\n\n**Solution:** This is expected! The `init` command now preserves existing profiles instead of clearing them.\n\n## Testing\n\nThe project has comprehensive test coverage and zero linting issues, leveraging Go's testing framework and `golangci-lint` for code quality.\n\n### Run Tests\n\n```bash\n# Run all tests\nmake test\n# Or:\ngo test -v\n\n# Run tests with coverage\nmake test-coverage\n# Or:\ngo test -v -cover\n\n# Generate detailed coverage report\nmake test-coverage-view\n# Or:\ngo test -coverprofile=coverage.out\ngo tool cover -html=coverage.out\n\n# Run benchmarks\nmake bench\n```\n\n### Linting and Formatting\n\n```bash\n# Run linter\nmake lint\n\n# Auto-fix linting issues\nmake lint-fix\n\n# Format code\nmake fmt\n\n# Run vet\nmake vet\n\n# Check everything (format + lint + test)\nmake check\n\n# Run all checks and build\nmake all\n```\n\n### Test Categories\n\n- **Configuration Management** - Profile CRUD, merging, persistence\n- **Git Operations** - Config file parsing, URL rewrites, backups\n- **UI Components** - Colored output, tables, formatting\n- **Command Integration** - Profile operations, error handling\n- **Edge Cases** - Invalid YAML, missing files, error paths\n\n## Architecture\n\n### Project Structure\n\n```text\ngit-context/\n├── cmd/                       # CLI commands\n│   ├── root.go               # Root command \u0026 init\n│   ├── add.go                # Add profile command\n│   ├── switch.go             # Switch profile command\n│   ├── list.go               # List profiles command\n│   ├── remove.go             # Remove profile command\n│   ├── current.go            # Show current profile\n│   ├── show.go               # Show profile details\n│   └── cmd_test.go           # Command tests\n├── internal/\n│   ├── config/\n│   │   ├── config.go         # Configuration management\n│   │   ├── config_test.go    # Config tests\n│   │   ├── paths.go          # Path management\n│   │   └── paths_test.go     # Path tests\n│   ├── git/\n│   │   ├── git.go            # Git operations\n│   │   └── git_test.go       # Git tests\n│   └── ui/\n│       ├── output.go         # UI/UX helpers\n│       └── output_test.go    # UI tests\n├── bin/                       # Build output\n├── main.go                    # Entry point\n├── go.mod                     # Go module dependencies\n├── go.sum                     # Dependency checksums\n└── README.md                  # This file\n```\n\n### Design Principles\n\n- **Separation of Concerns** - Clear boundaries between CLI, config, git, and UI layers\n- **Testability** - High test coverage with isolated unit tests\n- **User Experience** - Colored output, clear messages, confirmation prompts\n- **Safety First** - Automatic backups, validation, error handling\n\n## Dependencies\n\n- [github.com/spf13/cobra](https://github.com/spf13/cobra) - CLI framework\n- [github.com/manifoldco/promptui](https://github.com/manifoldco/promptui) - Interactive prompts\n- [github.com/fatih/color](https://github.com/fatih/color) - Colored terminal output\n- [gopkg.in/yaml.v3](https://gopkg.in/yaml.v3) - YAML parsing and serialization\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'feat: add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a [Pull Request](https://github.com/techquestsdev/git-context/pulls)\n\n### Before Submitting\n\n- Ensure all tests pass (`go test -v ./...`)\n- Maintain or improve code coverage\n- Follow existing code style\n- Add tests for new features\n- Update documentation as needed\n\n### Development Commands\n\nThe project includes a comprehensive Makefile with the following commands:\n\n```bash\n# Show all available make commands\nmake help\n\n# Development\nmake run                  # Run the application\nmake build                # Build the binary\nmake install              # Install to GOPATH/bin\n\n# Testing\nmake test                 # Run tests with race detection\nmake test-verbose         # Run tests with verbose output\nmake test-coverage        # Generate coverage report\nmake test-coverage-view   # Generate and open coverage report in browser\nmake bench                # Run benchmarks\n\n# Code Quality\nmake lint                 # Run golangci-lint\nmake lint-fix             # Run linter with auto-fix\nmake fmt                  # Format code with gofmt\nmake vet                  # Run go vet\nmake check                # Run all checks (fmt, vet, lint, test)\n\n# Dependencies\nmake deps                 # Download dependencies\nmake deps-upgrade         # Upgrade all dependencies\nmake deps-verify          # Verify dependencies\n\n# Cleanup\nmake clean                # Remove build artifacts and coverage reports\nmake clean-all            # Full cleanup including Go cache\n\n# Utilities\nmake mod-graph            # Show module dependency graph\nmake mod-why PKG=...      # Show why a package is needed\nmake version              # Show Go version\n\n# All-in-one\nmake all                  # Run fmt, lint, test, and build\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- [Cobra](https://github.com/spf13/cobra) for the excellent CLI framework\n- [Bubble Tea](https://github.com/charmbracelet/bubbletea) ecosystem for inspiration\n- [PromptUI](https://github.com/manifoldco/promptui) for interactive prompts\n\n## Contact\n\nAndré Nogueira - [@aanogueira](https://github.com/aanogueira)\n\nProject Link: [https://github.com/techquestsdev/git-context](https://github.com/techquestsdev/git-context)\n\n---\n\n### Made with ❤️ and Go\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechquestsdev%2Fgit-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechquestsdev%2Fgit-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechquestsdev%2Fgit-context/lists"}