MCP ExplorerExplorer

Git Flash

@aloshdennyon 4 days ago
7 MIT
FreeCommunity
AI Systems
Git MCP Assistant

Overview

What is Git Flash

Git Flash is an AI-powered git assistant that employs FastMCP and the Google Gemini API to simplify git operations. It enables users to execute a series of git commands based on natural language instructions or to generate commit messages for staged changes.

Use cases

Git Flash can be utilized for various tasks including creating and switching branches, stashing and applying changes, listing branches, and managing files and directories through natural language commands. It is also useful for developers who want to quickly generate meaningful commit messages for their work.

How to use

To use Git Flash, install the package via pip after setting up your Gemini API key. Once installed, run the git flash command in any git repository directory, followed by natural language instructions for executing git commands, or use the -m option to commit with a custom message. The --dry-run flag can also be used to preview commands before execution.

Key features

Key features of Git Flash include an agentic natural language processing capability that converts user instructions directly into git commands, support for staging and committing changes with user-defined messages, and a dry run option to ensure command accuracy without making actual changes.

Where to use

Git Flash can be used in any directory that is initialized as a git repository, making it applicable for software development projects across various environments and platforms. It is particularly beneficial in collaborative settings where quick and intuitive git operations are needed.

Content

Git Flash: Barry Allen of the CLI

Git Flash Logo

This tool uses FastMCP and the Google Gemini API to provide an AI-powered git assistant. It can function as an agent to execute a series of git commands based on natural language, or it can be used to simply generate a commit message for your staged changes.

Setup

Git Flash Setup and Demo

  1. Set Your API Key: This tool requires a Gemini API key. The first time you run it, it will prompt you to enter your key and offer to save it to ~/.config/git-flash/.env. Alternatively, you can set it as an environment variable:

    export GEMINI_API_KEY="your-gemini-api-key"
    
  2. Install the Package: Navigate to the git-flash directory and install it using pip. Using the -e flag (editable mode) is recommended for development.

    pip install git-flash
    

    This command installs the git-flash command into your system’s PATH.

Usage

You can run the assistant from within any git repository directory.

File Manipulation with Git Flash

Mode 1: Agentic Flow (Natural Language)

Provide an instruction in plain English, and the agent will determine the necessary git commands and execute them one by one.

Examples:

# Create a new branch and switch to it
git flash "create a new feature branch called 'login-flow' and check it out"

# Stash changes, switch branches, and pop the stash
git flash "stash my current work, switch to the 'main' branch, and then apply my stash"

# List all branches, local and remote
git flash "show me all the branches"

# File and directory creation/deletion
git flash "create a file named 'docs/plan.md' and write a to-do list for the new feature"

# File and directory manipulation
git flash "reorganize files as production"

Mode 2: Manual Commit Message

If you know what you want to commit, use the -m or --message option. This will stage all current changes and commit with your message.

git flash -m "feat: add user authentication endpoint"

Dry Run

For any of the modes, you can add the --dry-run flag to see what commands the agent would run without actually executing them. This is great for safety and testing.

git flash "create a hotfix branch and merge it into main" --dry-run

Tools

No tools

Comments