Skip to main content

gcop is your git AI copilot.

Project description

GCOP Banner

GCOP (Git Copilot) is an intelligent assistant that enhances your Git workflow by automating commit message generation using AI. It's designed to make your development process smoother and more efficient by improving git commit practices, conventional commits, and version control. With GCOP, you can create better commit messages, maintain a clean git history, and streamline your git commit workflow.

🚀 Key Features

  • Smart Commit Messages: Let AI generate better commit messages based on your changes.
  • Flexible AI Integration: Support any language model you want.
  • Simplified Git Commands: Powerful aliases for common Git operations to speed up your workflow.

Video Demo

This video shows how to use gcop to generate a commit message. See the documentation

Gcop is your git AI copilot

🛠️ Getting Started

We recommend you to read the Quick Start Guide in detail.

What You'll Need

  • Python 3.8 or newer
  • Git installed on your system
  • An API key for your preferred LLM (e.g., OpenAI, Anthropic)

Installation

  1. Install GCOP with pip:

    pip install gcop
    
  2. Initialize GCOP:

    gcop init
    

This command sets up GCOP and adds its aliases to your Git configuration.

  1. Configure your AI model:

    git gconfig
    

    This opens the configuration file. Edit it to include your AI provider details:

    model:
      model_name: provider/name, eg openai/gpt-4o
      api_key: your_api_key
    

Then gcop will generate a config.yaml, then gcop will open the config.yaml file in the default editor, and you can config your language model. See how to config your model here:

config.yaml store path:

  • Windows: %USERPROFILE%\.zeeland\gcop\config.yaml
  • Linux: ~/.zeeland/gcop/config.yaml
  • MacOS: ~/.zeeland/gcop/config.yaml
  1. Verify the installation:

    git ghelp
    

    You should see output similar to:

    gcop is your local git command copilot
    Version: 1.0.0
    GitHub: https://github.com/Undertone0809/gcop
    
    Usage: git [OPTIONS] COMMAND
    
    Commands:
      git p          Push changes to remote repository
      git pf         Force push changes to remote repository
      git undo       Undo last commit, keep changes
      git ghelp      Show this help message
      git gconfig    Open config file in default editor
      git gcommit    Generate AI commit message and commit changes
      git ac         Add all changes and commit with AI message
      git c          Shorthand for 'git gcommit'
    

💡 Basic Usage

Generating AI Commit Messages

After making changes to your project:

  1. Stage your changes:

    git add .
    
  2. Generate and apply an AI commit message:

    git c
    

    Example output:

    ? Select a commit message to commit (Use arrow keys)
     » feat: Implement user authentication system
       docs: Update installation instructions in README
       fix: Resolve database connection timeout issue
       style: Improve code formatting in src/main.py
       retry
    
  3. Choose the most appropriate message using arrow keys and press Enter.

Other Useful Commands

  • git ac: Add all changes and commit with an AI-generated message

    git ac
    

    Output:

    Changes added. Generating commit message...
    ? Select a commit message to commit (Use arrow keys)
     » feat: Add new user profile page
       fix: Correct CSS styling issues on mobile devices
       docs: Update API documentation for v2.0
       refactor: Optimize database queries for better performance
       retry
    
  • git undo: Undo the last commit while keeping changes staged

    git undo
    

    Output:

    HEAD is now at a1b2c3d Previous commit message
    Changes from the last commit are now staged.
    
  • git p: Push to the current branch

    git p
    

    Output:

    Enumerating objects: 5, done.
    Counting objects: 100% (5/5), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (3/3), 328 bytes | 328.00 KiB/s, done.
    Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
    To https://github.com/username/repo.git
       a1b2c3d..e4f5g6h  main -> main
    
  • git pf: Force push to the current branch (use with caution)

  • git gconfig: Open the GCOP configuration file for adjustments

🔧 Configuration

To modify your AI model settings:

  1. Open the config file:

    git gconfig
    
  2. Edit the config.yaml file:

    model:
      model_name: provider/name, eg openai/gpt-4o
      api_key: your_api_key
    
  3. Save and close the file.

📚 Learn More

Makefile usage

Makefile contains a lot of functions for faster development.

Install all dependencies and pre-commit hooks

make install

Codestyle and type checks

Automatic formatting uses ruff.

make polish-codestyle

# or use synonym
make formatting

Codestyle checks only, without rewriting files:

make check-codestyle

Note: check-codestyle uses ruff and darglint library

Code security

If this command is not selected during installation, it cannnot be used.

make check-safety

This command launches Poetry integrity checks as well as identifies security issues with Safety and Bandit.

make check-safety

Tests with coverage badges

Run pytest

make test

All linters

Of course there is a command to run all linters in one:

make lint

the same as:

make check-codestyle && make test && make check-safety

Docker

make docker-build

which is equivalent to:

make docker-build VERSION=latest

Remove docker image with

make docker-remove

More information about docker.

Cleanup

Delete pycache files

make pycache-remove

Remove package build

make build-remove

Delete .DS_STORE files

make dsstore-remove

Remove .mypycache

make mypycache-remove

Or to remove all above run:

make cleanup

📦 Techs

🛡 License

License

This project is licensed under the terms of the MIT license. See LICENSE for more details.

🤝 Support

For more information, please contact: zeeland4work@gmail.com

See anything changelog, describe the telegram channel

Credits 🚀 Your next Python package needs a bleeding-edge project structure.

This project was generated with P3G

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcop-1.7.1.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

gcop-1.7.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file gcop-1.7.1.tar.gz.

File metadata

  • Download URL: gcop-1.7.1.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.20 Linux/6.5.0-1025-azure

File hashes

Hashes for gcop-1.7.1.tar.gz
Algorithm Hash digest
SHA256 7b55b4538ecf5564146f8dcfc8b061d3263e266a3328bb628b71e26c8e813bc9
MD5 2c5945c0930f3ea697dbe9d4e2190335
BLAKE2b-256 9e4e2a1c6bc7052a78b37995fb15ba859414aac90889cf13cd1595351d36118b

See more details on using hashes here.

File details

Details for the file gcop-1.7.1-py3-none-any.whl.

File metadata

  • Download URL: gcop-1.7.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.20 Linux/6.5.0-1025-azure

File hashes

Hashes for gcop-1.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2237e57c16aa963f89bf98806df436b6540af6a8c4ae9c98a7747d13d67bd3c
MD5 ef89c2ad01e9fcf6a31d4a92a9958abb
BLAKE2b-256 94f51612e2a67dc135960ed7f8998c643db609b066e473f3c69a89190287e22a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page