Skip to main content

User-friendly Git CLI automation tool with interactive menus and visual feedback

Project description

GitCLI - Git Operations Automation

A user-friendly command-line interface for Git operations with interactive menus, visual feedback, and cross-platform support.

Features

  • 🎨 Colored output for better readability
  • Loading spinners for operations
  • 🔔 System notifications (macOS/Linux/Windows)
  • ⌨️ Tab completion in interactive mode
  • 🛡️ Safety checks for destructive operations
  • 🖥️ Cross-platform support (macOS, Linux, Windows)
  • 🚀 Direct command execution or interactive mode

Installation

From PyPI

pip3 install gitcli-automation
# Windows: pip install gitcli-automation

From Source

git clone https://github.com/Adelodunpeter25/GitCLI.git
cd gitcli
pip install -e .

Usage

Interactive Mode

Launch the interactive menu:

gitcli

Direct Command Mode

Execute commands directly:

gitcli <command>
# e.g., gitcli commit

Available Commands

Core Operations

commit

Commit staged changes with an interactive prompt for the commit message.

gitcli commit
  • Automatically offers to stage all changes if nothing is staged
  • Validates commit message is not empty
  • Shows visual feedback with spinners

push

Push commits to the remote repository.

gitcli push
  • Checks for remote repository configuration
  • Offers to commit unstaged changes before pushing
  • Handles push rejections with force push option
  • Prompts for confirmation on force push (requires typing "yes")

pull

Pull latest changes from the remote repository.

gitcli pull
  • Fetches and merges changes from remote
  • Shows success/failure notifications

sync

Pull then push in one command - keeps your branch synchronized.

gitcli sync
  • Pulls latest changes first
  • Automatically pushes if local branch is ahead
  • Stops if pull fails (e.g., merge conflicts)

fetch

Fetch updates from remote without merging.

gitcli fetch
  • Updates remote tracking branches
  • Shows how many commits behind you are
  • Suggests using pull to merge changes

stage

Stage changes for commit with options.

gitcli stage

Options:

  1. Stage all changes (git add .)
  2. Stage specific files (interactive file selection)

status

Show the current git status.

gitcli status
  • Displays branch information
  • Shows staged/unstaged changes
  • Lists untracked files

log

View recent commit history.

gitcli log
  • Shows last 10 commits
  • Displays as a graph with decorations
  • One-line format for easy reading

Diff Operations

diff

Show unstaged changes (what you've modified but not staged).

gitcli diff
  • Color-coded diff output
  • Shows line-by-line changes

diff-staged

Show staged changes (what will be committed).

gitcli diff-staged
  • Preview changes before committing
  • Helps verify what you're about to commit

Branch Management

switch-branch

Switch to another branch.

gitcli switch-branch
  • Lists all available branches
  • Offers to create branch if it doesn't exist
  • Interactive branch selection

add-branch

Create a new branch and switch to it.

gitcli add-branch
  • Prompts for branch name
  • Automatically sanitizes name (replaces spaces with hyphens)
  • Switches to new branch immediately

delete-branch

Delete a branch with safety checks.

gitcli delete-branch
  • Prevents deleting current branch
  • Options for safe delete or force delete
  • Requires confirmation

rename-branch

Rename a branch.

gitcli rename-branch
  • Can rename current branch or specify another
  • Sanitizes new branch name
  • Updates branch reference

list-branch

List all branches (local and remote).

gitcli list-branch
  • Shows current branch highlighted
  • Displays remote tracking branches

Quick Operations

quick-push or qp

Stage all changes, commit, and push in one command.

gitcli qp
# or
gitcli quick-push
  • Stages all changes automatically
  • Prompts for commit message
  • Pushes to remote
  • Handles force push if needed
  • Perfect for quick updates

Advanced Operations

amend

Amend the last commit.

gitcli amend

Options:

  1. Change commit message only
  2. Add more changes to commit (keep message)
  3. Add more changes and update message

Warns about force push if commit was already pushed.

reset

Reset to a previous commit.

gitcli reset

Options:

  1. Reset to last commit (hard reset)
  2. Reset to specific commit ID

⚠️ Warning: Hard reset discards all uncommitted changes!

  • Requires typing "yes" for confirmation
  • Shows recent commits for reference

remotes

Manage remote repositories.

gitcli remotes

Options:

  1. List remotes
  2. Add remote
  3. Remove remote
  4. View remote URLs

clone

Clone a repository interactively.

gitcli clone
  • Prompts for repository URL
  • Optional custom folder name
  • Shows navigation hint after cloning
  • Works even outside a git repository

Utility Commands

help

Display all available commands with descriptions.

gitcli help

quit

Exit GitCLI (interactive mode only).

quit

Command Examples

Typical Workflow

# Check status
gitcli status

# View changes
gitcli diff

# Stage and commit
gitcli stage
gitcli commit

# Push to remote
gitcli push

Quick Workflow

# Stage, commit, and push in one command
gitcli qp

Sync Workflow

# Pull latest changes and push yours
gitcli sync

Branch Workflow

# Create new feature branch
gitcli add-branch

# Work on changes...
gitcli qp

# Switch back to main
gitcli switch-branch

Interactive Mode Features

When running gitcli without arguments:

  • Tab completion: Press Tab to autocomplete commands
  • Branch indicator: Shows current branch in prompt
  • Persistent session: Run multiple commands without restarting
  • Command history: Use arrow keys to navigate previous commands

Safety Features

  • Confirmation prompts for destructive operations (delete, reset, force push)
  • "yes" requirement for dangerous operations (not just "y")
  • Branch protection: Can't delete current branch
  • Change detection: Warns about uncommitted changes
  • Remote checks: Validates remote exists before push/pull operations

Project Structure

GitCLI/
├── gitcli/
│   ├── __init__.py         # Package initialization
│   ├── cli.py              # Main entry point and CLI interface
│   ├── helpers.py          # Utility functions
│   ├── git_operations.py   # Core git operations
│   ├── git_branches.py     # Branch management
│   └── git_advanced.py     # Advanced operations
├── setup.py                # Package configuration
├── pyproject.toml          # Modern Python packaging
├── LICENSE                 # MIT License
├── README.md               
└── requirements.txt        # Dependencies

Requirements

  • Python 3.7+
  • Git installed and configured
  • colorama (for colored output)
  • yaspin (for loading spinners)
  • win10toast (optional, for Windows notifications)

Platform Support

  • macOS: Full support with native notifications
  • Linux: Full support with notify-send
  • Windows: Full support (install win10toast for notifications)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (gitcli add-branch feature-name)
  3. Commit your changes (gitcli commit)
  4. Push to the branch (gitcli push)
  5. Open a Pull Request

License

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

Author

Adelodunpeter - GitHub

Troubleshooting

Command not found after installation?

  • Ensure pip install location is in your PATH
  • Try python -m gitcli.cli as alternative

Import errors?

  • Verify all dependencies are installed: pip install -r requirements.txt

Git errors?

  • Ensure Git is installed: git --version
  • Verify you're in a Git repository or use gitcli clone

Notifications not working?

  • macOS/Linux: Should work out of the box
  • Windows: Install win10toast: pip install win10toast

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

gitcli_automation-0.1.2.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitcli_automation-0.1.2-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file gitcli_automation-0.1.2.tar.gz.

File metadata

  • Download URL: gitcli_automation-0.1.2.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gitcli_automation-0.1.2.tar.gz
Algorithm Hash digest
SHA256 703ff95f1ca864caafb55d6986256f6c17f8fe9ba76c5f8dc44fbd2d0e98ca88
MD5 44baf21a6cb4586c0e92789e5c4e0869
BLAKE2b-256 36406741b444a4536f9622bd01aab95f6a1724aedfc5a6fd3b7b3ad13a710ad6

See more details on using hashes here.

File details

Details for the file gitcli_automation-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for gitcli_automation-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c98bba2d5c0b3e59258eddad0735faf59262822e3dd14fcfe9b7e4bb6065f1ce
MD5 8304fb022bd853d181a74fdc6523ee43
BLAKE2b-256 f2dd702cf7d4cb69f401a8b825f88f4139995d38224d8c2715e287a35ee623be

See more details on using hashes here.

Supported by

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