Skip to main content

gcop is your git AI copilot.

Project description

img.png

Gcop is your git AI copilot. You can use any large language model to help automate the generation of commit messages.

Features

  • Generate commit messages by large language models.
  • Easily config your language model.
  • Powerful and simple alias commands to use.

TECH

Video Demo

Gcop is your git AI copilot

Quick Start

  • Install gcop
pip install gcop
  • If you are first time to use gcop, you need to run the gcop init command to initialize the configuration. This command will alias gcop command on your git.
gcop init

Basic Usage

Run the git ghelp command to get help information and show all gcop commands.

gcop is your local git command copilot
Version: 1.0.0
GitHub: https://github.com/Undertone0809/gcop


Usage: git [OPTIONS] COMMAND

Commands:
  git undo       Undo the last commit but keep the file changes
  git pf         Push the changes to the remote repository with force
  git ghelp      Add command into git config
  git gconfig    Open the config file in the default editor
  git gcommit    Generate a git commit message based on the staged changes and commit the changes
  git c          The same as `git gcommit` command

Config your language model

Before you generate a commit message, you need to config your language model. You can use any large language model to generate commit messages. The following example shows how to config the language model.

git gconfig

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%\.gcop\config.yaml
  • Linux: ~/.gcop/config.yaml
  • MacOS: ~/.gcop/config.yaml

Generate commit message

The following example show how to use gcop to generate a commit message.

git add .
git gcommit

Video Demo

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

Gcop is your git AI copilot

All commands

git gcommit / git c

Generate a git commit message based on the staged changes and commit the changes.

> git c # You can also use `git gcommit` command
? Select a commit message to commit (Use arrow keys)
 » docs: Add 'All commands' section to README.md
   feat: Add 'git gcommit' and 'git gconfig' commands to README.md
   feat: Add 'git config --global alias.pf' command in __main__.py
   retry

git gconfig

Open the config file in the default editor.

git undo

Undo the last commit.

git pf

Push force to the current branch, equivalent to git push --force.

Development setup

Conda package manager is recommended. Create a conda environment.

conda create -n gcop python==3.10

Activate conda environment and install poetry

conda activate gcop
pip install poetry

Then you can run the client using the following command:

gcop --help

or with Poetry:

poetry run gcop --help

Makefile usage

Makefile contains a lot of functions for faster development.

Install all dependencies and pre-commit hooks

Install requirements:

make install

Pre-commit hooks coulb be installed after git init via

make pre-commit-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

🛡 License

License

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

Contact

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.2.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

gcop-1.2.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gcop-1.2.0.tar.gz
Algorithm Hash digest
SHA256 611c44c6446207c76b9e3396f57f9851475968eef42402342beb3d587734392b
MD5 0d9aed5a1df3238659627bd833e53c1b
BLAKE2b-256 f39946e28fc4c75b87df34170f9ff6acdf46ed758db38002f99383cb2427d8c6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gcop-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a51894c7ac8eee30fff49ec1ef28ca1f8f7728a31c3fea6af6df6f042d37ba3f
MD5 ebcaf6e855e35dfafa58c43ac86ce1ad
BLAKE2b-256 f417aced38ac684e487484d8da9372e059c05d3f14df4ba9f41052ec3b9b5092

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