Git Aliases
Complete guide to gcop-rs git aliases - convenient shortcuts for your daily Git workflow.
Overview
gcop-rs provides 13 carefully designed git aliases that streamline common tasks:
| Alias | Command | Description |
|---|---|---|
git c | gcop-rs commit | Quick AI-powered commit |
git r | gcop-rs review | AI review of changes |
git s | gcop-rs stats | Repository statistics |
git ac | git add -A && gcop-rs commit | Add all and commit |
git cp | gcop-rs commit && git push | Commit and push |
git acp | git add -A && gcop-rs commit && git push | Add, commit, and push |
git cop | gcop-rs | Main gcop-rs entry point |
git gcommit | gcop-rs commit | Full command alias |
git ghelp | gcop-rs --help | Show help |
git gconfig | gcop-rs config edit | Edit configuration |
git p | git push | Quick push |
git pf | git push --force-with-lease | Safer force push |
git undo | git reset --soft HEAD^ | Undo last commit |
Installation
Quick Install
# Install all aliases
gcop-rs alias
# Verify installation
gcop-rs alias --listDuring Initial Setup
# The init command will prompt you
gcop-rs initWhen prompted "Install git aliases?", select Yes to install all aliases automatically.
Verification
Check installed aliases:
gcop-rs alias --listOutput:
ℹ Available git aliases for gcop-rs:
git cop → Main entry point for gcop-rs [✓ installed]
git gcommit → AI commit message and commit changes [✓ installed]
git c → Shorthand for 'git gcommit' [✓ installed]
git r → AI review of uncommitted changes [✓ installed]
...Available Aliases
Commit Aliases
git c - Quick Commit
The fastest way to create AI-powered commits.
Command: gcop-rs commit
Usage:
# Stage your changes
git add src/auth.rs
# Generate and commit
git c
# Or with options
git c --no-edit # Skip editor
git c --yes # Skip confirmation menuWhen to use: Your primary commit command. Use this instead of git commit for AI-generated messages.
git ac - Add and Commit
Add all changes and commit in one step.
Command: git add -A && gcop-rs commit
Usage:
# Modified several files?
git acEquivalent to:
git add -A
git cWhen to use: When you want to commit all changes without manually staging them first.
git acp - Add, Commit, and Push
Complete workflow: add all changes, commit with AI, and push to remote.
Command: git add -A && gcop-rs commit && git push
Usage:
# Complete a feature and push
git acpEquivalent to:
git add -A
git c
git pushWhen to use: For quick iterations when you're confident about pushing immediately after committing.
⚠️ Note: Only use when you're sure you want to push. The commit and push will only happen if the previous command succeeds.
Review Aliases
git r - Review Changes
Get AI-powered code review of your uncommitted changes.
Command: gcop-rs review
Usage:
# Review changes before committing
git r
# Review with different format
git r --format json
git r --format markdownWhat it reviews: All uncommitted changes in your working directory (both staged and unstaged).
When to use:
- Before committing to catch potential issues
- For quick code quality checks
- To get suggestions for improvements
Example workflow:
# Make changes
vim src/auth.rs
# Review changes
git r
📝 Summary:
Added JWT token validation with proper error handling.
🔍 Issues found:
1. WARNING: Consider adding rate limiting for token validation
💡 Suggestions:
• Add unit tests for edge cases
• Document the token validation logic
# Address issues, then commit
git cUtility Aliases
git undo - Undo Last Commit
Safely undo the last commit while keeping your changes staged.
Command: git reset --soft HEAD^
Usage:
# Just made a commit but want to modify it?
git undo
# Your changes are still staged, edit them
vim src/auth.rs
# Commit again with new message
git cWhat it does:
- Moves HEAD back one commit (
HEAD^= previous commit) - Keeps changes in staging area (ready to commit)
- Preserves your working directory
When to use:
- Wrong commit message
- Forgot to include a file
- Want to split the commit
- Need to amend the changes
⚠️ Safety: This is safe for local commits. If you've already pushed, see "Undoing Pushed Commits" below.
Example:
$ git log --oneline
abc123 feat: add auth (current HEAD)
def456 fix: typo
$ git undo
$ git log --oneline
def456 fix: typo (current HEAD)
$ git status
Changes to be committed:
modified: src/auth.rs
# Your changes are still staged!git p - Quick Push
Shorthand for git push.
Command: git push
Usage:
git pWhen to use: When you want a shorter push command.
git pf - Safer Force Push
Force push with --force-with-lease for safety.
Command: git push --force-with-lease
Usage:
# After rebasing
git rebase -i HEAD~3
git pfWhy --force-with-lease:
- Safer than
--force - Only pushes if nobody else has pushed to the remote
- Prevents accidentally overwriting others' work
When to use:
- After rebasing
- After amending commits
- When you need to rewrite history
⚠️ Warning: Only force push to branches you own. Never force push to main or master!
git gconfig - Edit Configuration
Open gcop-rs configuration in your default editor.
Command: gcop-rs config edit
Usage:
git gconfigOpens: ~/.config/gcop/config.toml in your $EDITOR
When to use: Quick access to edit your gcop-rs settings (API keys, models, prompts, etc.).
git ghelp - Show Help
Display gcop-rs help information.
Command: gcop-rs --help
Usage:
git ghelpgit cop - Main Entry Point
Direct access to gcop-rs command.
Command: gcop-rs
Usage:
git cop commit
git cop review
git cop --versionWhen to use: When you prefer the git cop prefix over gcop-rs.
git gcommit - Full Command Alias
Alternative to git c with a more descriptive name.
Command: gcop-rs commit
Usage:
git gcommitWhen to use: If you prefer more explicit command names.
Management
Listing Aliases
See all available aliases and their installation status:
gcop-rs alias --listOutput shows:
- ✓ Installed: Alias is configured and ready
- ⚠ Conflicts: Alias name already used by another command
- Not installed: Alias is not configured
Updating Aliases
Reinstall all aliases (useful after updates):
gcop-rs alias --forceThis will overwrite any conflicting aliases.
Removing Aliases
Remove all gcop-rs aliases:
# Preview what will be removed
gcop-rs alias --remove
# Actually remove (requires --force)
gcop-rs alias --remove --force⚠️ Warning: This removes all gcop-rs aliases from your global git config.
Advanced Usage
Combining Aliases
You can chain aliases with other git commands:
# Create a new branch, commit, and push
git checkout -b feature/auth
git acp
# Review, commit, and push
git r && git acp
# Undo, edit, and recommit
git undo && vim src/auth.rs && git cCustom Workflows
Create your own aliases that build on gcop-rs:
# Add to your shell rc file (~/.bashrc, ~/.zshrc)
alias gac="git ac" # Even shorter add-commit
alias gacp="git acp" # Even shorter add-commit-push
alias review="git r" # Plain 'review' commandTroubleshooting
Alias Already Exists
Problem: You see "conflicts with: existing-command"
Solution:
# Option 1: Force overwrite
gcop-rs alias --force
# Option 2: Remove the conflicting alias first
git config --global --unset alias.c
gcop-rs aliasCommand Not Found
Problem: git c says "command not found"
Diagnosis:
# Check if gcop-rs is in PATH
which gcop-rs
# Check if alias is installed
git config --global alias.cSolution:
# If gcop-rs not in PATH
export PATH="$PATH:/usr/local/bin"
# If alias not installed
gcop-rs aliasAlias Not Working After Update
Problem: Alias uses old command syntax
Solution:
# Reinstall all aliases
gcop-rs alias --forceBest Practices
Recommended Workflow
- Start with
git c: Use as your default commit command - Use
git rbefore committing for quality checks - Use
git acfor quick commits of all changes - Reserve
git acpfor confident, tested changes
When to Use Full Commands
Use full gcop-rs commands instead of aliases when:
- Writing scripts (for clarity)
- Documenting workflows
- Using advanced options not available in aliases
Safety Tips
- Review before
git acp: This pushes immediately, so usegit rfirst - Use
git undofreely: It's safe for local changes - Be careful with
git pf: Only force push to your own branches - Check status: Run
git statusaftergit undoto see your staged changes
Examples
Daily Development Workflow
# Morning: Start new feature
git checkout -b feature/user-profile
# Work on it
vim src/profile.rs
vim src/routes.rs
# Review changes
git r
# Commit (all changes)
git ac
# More work
vim tests/profile_test.rs
# Quick commit and push
git acpFixing a Mistake
# Oops, wrong commit message
git undo
# Fix and recommit
git c --yesCode Review Workflow
# Before creating PR
git r # Check your changes
# If issues found, fix them
vim src/auth.rs
# Review again
git r
# Satisfied? Commit
git cSee Also
- Command Reference - Full documentation of all gcop-rs commands
- Configuration Guide - Customize gcop-rs behavior
- Troubleshooting - Common issues and solutions