/go-git-swap

Go Git Swap is a command-line tool that helps developers manage multiple Git configurations easily. Switch between different Git profiles seamlessly, perfect for developers who work with multiple Git accounts (personal, work, client projects, etc.).

Primary LanguageGo

Go Git Swap

Go Report Card License: MIT

Note: This is my first Go project! I'm actively learning and improving it. Feedback and contributions are very welcome!

Inspired by the need to manage multiple Git configurations easily. Go Git Swap is a command-line tool that helps developers manage multiple Git configurations easily. Switch between different Git profiles seamlessly, perfect for developers who work with multiple Git accounts (personal, work, client projects, etc.).

πŸ—ΊοΈ Roadmap

Coming Soon (Q2/3 2025)

  • Modern TUI interface using Bubble Tea or similar
  • Enhanced SSH signing key support
  • Profile templates and quick switching
  • Configuration backup

Features ✨

Current features:

  • Manage multiple Git profiles
  • Easy switching between profiles
  • Basic SSH signing key support
  • Automatic configuration of Git global settings
  • Simple CLI interface
  • Cross-platform support (macOS, Linux)
  • Secure local configuration storage

Installation πŸš€

Using Go

go install github.com/frivas/go-git-swap@latest

From Releases

Download the latest release for your platform from the releases page.

Building from Source

# Clone the repository
git clone https://github.com/frivas/go-git-swap.git
cd go-git-swap

# Build for your platform
make build

# Or build for all supported platforms
make build-all

Usage πŸ’‘

  1. Start the application:
go-git-swap
  1. Create a new profile:

    • Select option 2
    • Enter profile details (name, email, username, etc.)
    • Optionally add an SSH signing key
  2. Switch between profiles:

    • Select option 1
    • Choose the profile you want to activate
  3. Delete a profile:

    • Select option 3
    • Choose the profile you want to remove

Configuration πŸ”§

The application stores its configuration in ~/.go-git-swap.json. Each profile contains:

  • Profile name (identifier)
  • Git username
  • Git email
  • Full name
  • SSH signing key path (optional)

Development πŸ› οΈ

Prerequisites

  • Go 1.20 or higher
  • Make (for building)

Building

# Build for current platform
make build

# Build for all platforms
make build-all

# Run tests
make test

# Clean build artifacts
make clean

Project Structure

.
β”œβ”€β”€ cmd/
β”‚   └── go-git-swap/       # Main application
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ config/           # Configuration management
β”‚   β”œβ”€β”€ git/             # Git operations
β”‚   β”œβ”€β”€ model/           # Data models
β”‚   └── validator/       # Input validation
β”œβ”€β”€ Makefile
└── README.md

Contributing 🀝

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Code Style

Please follow these guidelines:

  • Use gofmt to format your code
  • Add comments for exported functions
  • Write tests for new functionality
  • Update documentation as needed

License πŸ“

This project is licensed under the MIT License - see the LICENSE file for details.

Support πŸ’ͺ

If you find this project useful, please consider giving it a ⭐️ on GitHub or forking it to make it better! Thanks!

For bugs, feature requests, or questions, please open an issue.